我想更改videojs v5控件布局,以便在vjs-control-bar区域顶部创建一个全宽度进度条,类似于v5之前的播放器皮肤.
我该怎么办?是否有必要修改组件中的组件结构树,ProgressControl或者只能使用现有ProgressControl组件的CSS来完成?
我注意到我可以通过将vjs-progress-control displayCSS属性更改为flexto 来将其置于顶部block,initial或者inline我无法将宽度设置为100%(仍然考虑其他ProgressControl组件宽度).我认为这是因为vjs-progress-control它仍然在容器的柔性流动中.
编辑
我取得了一些进展.我可以使用以下CSS实现所需的效果:
.vjs-progress-control {
position: absolute;
bottom: 26px; /* The height of the ControlBar minus 4px. */
left: 0;
right: 0;
width: 100%;
height: 10px; /* the height must be reduced from 30 to 10px in order to allow the buttons below (e.g. play) to be pushed */
}
.vjs-progress-holder {/* needed to have a real 100% width display. */
margin-left: 0px;
margin-right: 0px;
}
Run Code Online (Sandbox Code Playgroud)
除非你们中的一个人找到一种方法来改善它,否则我会在允许的情况下将此编辑发布为已接受的答案.
.vjs-fluid {
overflow: hidden;
}
.vjs-control-bar {
display: block;
}
.vjs-control {
position: absolute;
}
.vjs-progress-control {
bottom: 28px; left: 0;
height: 10px;
width: 100%;
}
.vjs-progress-holder {
position: absolute;
left: 0; margin: 0;
height: 8px; width: 100%;
}
.vjs-play-progress,
.vjs-load-progress {
height: 8px;
}
.vjs-play-progress:before {
font-size: 12px; top: -2px;
text-shadow: 0 0 2px black
}
.vjs-current-time {
display: block;
left: 35px;
}
.vjs-time-divider {
position: absolute;
display: block;
left: 70px;
}
.vjs-remaining-time {
display: none;
}
.vjs-duration {
display: block;
left: 70px;
}
.vjs-volume-menu-button {
position: absolute;
bottom: 0; right: 55px;
}
.vjs-playback-rate {
position: absolute;
bottom: 0; right: 28px;
}
.vjs-fullscreen-control {
position: absolute;
bottom: 0; right: 0;
}
Run Code Online (Sandbox Code Playgroud)
仍然需要设置字幕,标题和章节按钮的样式