⑴ videojs如何在控制栏上增加一个按钮
这是实现之后的效果
源码:
//自定义控制条
var player = videojs(videoId,
{
"controls": true,
"autoplay": false,
"preload": "auto",
"loop": false,
controlBar:
{
captionsButton: false,
chaptersButton: false,
playbackRateMenuButton: true,
LiveDisplay: true,
subtitlesButton: false,
remainingTimeDisplay: true,
progressControl: true,
volumeMenuButton:
{
inline: false,
vertical: true
},
//竖着的音量条
fullscreenToggle: true
}
}, function () {
var newbtn = document.createElement('btn');
newbtn.innerHTML = '<button class="vjs-control" id="downloadButton"><i class="fa fa-expand" title="全屏"></i></button>' + '<button class="vjs-control" id="full_screen_button"><i class="fa fa-chrome" title="截图"></i></button>' ;
var controlBar = document.getElementsByClassName('vjs-control-bar')[0];
insertBeforeNode = document.getElementsByClassName('vjs-fullscreen-control')[0];
controlBar.insertBefore(newbtn,insertBeforeNode);
player.src({ type : "rtmp/flv", src : r.roomLiveUri});
player.play();
});
里面用到了一些前端框架的样式,所以按钮图标你需要自己去找,参考的是这位大佬的博客:网页链接