3

我对此完全陌生。我已经设法让 video.js 在我的网站上运行,但我需要创建带有可供选择的视频的播放列表。是否有捷径可寻?

谢谢

4

2 回答 2

2
<link href="videojs-playlist-ui.vertical.css" rel="stylesheet">

<script src="videojs.min.js"></script>
<script src="videojs-playlist.js"></script>
<script src="videojs-playlist-ui.min.js"></script>

//The HTML Code

    <video autoplay id="player" class="video-js vjs-fluid" controls>
        <source src="somevideo.mp4" type="video/mp4">
    </video>

    <div class="playlist-container  preview-player-dimensions vjs-fluid">
        <ol class="vjs-playlist"></ol>
    </div>

// Your script
<script>
    var player = videojs('player');

    player.playlistUi();

    player.playlist([{
        sources: [{
            src: 'http://media.w3.org/2010/05/sintel/trailer.mp4',
            type: 'video/mp4'
        }],
        poster: 'http://media.w3.org/2010/05/sintel/poster.png'
        }, {
        sources: [{
            src: 'http://media.w3.org/2010/05/bunny/trailer.mp4',
            type: 'video/mp4'
        }],
        poster: 'http://media.w3.org/2010/05/bunny/poster.png'
        }, {
        sources: [{
            src: 'http://vjs.zencdn.net/v/oceans.mp4',
            type: 'video/mp4'
        }],
        poster: 'http://www.videojs.com/img/poster.jpg'
        }, {
        sources: [{
            src: 'http://media.w3.org/2010/05/bunny/movie.mp4',
            type: 'video/mp4'
        }],
        poster: 'http://media.w3.org/2010/05/bunny/poster.png'
        }, {
        sources: [{
            src: 'http://media.w3.org/2010/05/video/movie_300.mp4',
            type: 'video/mp4'
        }],
        poster: 'http://media.w3.org/2010/05/video/poster.png'
    }]);

       // Play through the playlist automatically. 
       player.playlist.autoadvance(0);

</script>

// 参考 https://www.npmjs.com/package/videojs-playlist

于 2016-11-18T22:38:30.537 回答
0

您可以尝试一些播放列表插件。它们列在插件页面上

于 2013-09-30T18:27:14.173 回答