为视频创建播放列表.js



我对此完全陌生。我已经设法制作了视频.js在我的网站上工作,但我需要创建带有视频可供选择的播放列表。有没有简单的方法可以做到这一点?

谢谢

<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

您可以

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

相关内容

  • 没有找到相关文章

最新更新