Video.js的使用小细节

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u013821237/article/details/80277502
1.不刷新界面换播放源(也不可以隐藏和显示切换)
    video.pause()
    video.setAttribute('src', '2.mp4');//或者video.src('url地址');
    video.load();
    video.play();
2.暂停时的播放按钮
.vjs-paused .vjs-big-play-button,
.vjs-paused.vjs-has-started .vjs-big-play-button {
    display: block;
}
3.播放按钮圆形
.video-js .vjs-big-play-button{
    font-size: 2.5em;
    line-height: 2.3em;
    height: 2.5em;
    width: 2.5em;
    -webkit-border-radius: 2.5em;
    -moz-border-radius: 2.5em;
    border-radius: 2.5em;
    background-color: #73859f;
    background-color: rgba(115,133,159,.5);
    border-width: 0.15em;
    margin-top: -1.25em;
    margin-left: -1.75em;
}
/* 中间的播放箭头 */
.vjs-big-play-button .vjs-icon-placeholder {
    font-size: 1.63em;
}
/* 加载圆圈 */
.vjs-loading-spinner {
    font-size: 2.5em;
    width: 2em;
    height: 2em;
    border-radius: 1em;
    margin-top: -1em;
    margin-left: -1.5em;
}
4.全屏和退出全屏
//全屏
myPlayer.enterFullScreen();
//离开全屏
myPlayer.enterFullScreen();
5.屏幕宽高自适应(添加类vjs-fluid)
<video id="my-video" class="video-js vjs-big-play-centered vjs-fluid" controls preload="auto" poster="" data-setup="{}">
    <source src="视频地址" type="video/mp4">
</video>



猜你喜欢

转载自blog.csdn.net/u013821237/article/details/80277502