Videojs add only play control

后端 未结 5 755
情深已故
情深已故 2021-02-04 21:03

I am using Video.js to play videos in my web page. I want to customize player controls to only play button.

my code is



        
5条回答
  •  渐次进展
    2021-02-04 21:43

    The way I was able to do it was by setting the css class for specific controls to display: none; in my page's CSS. My page's CSS gets linked AFTER the video-js.css gets linked.

    /* Video.js Controls Style Overrides */
    .vjs-default-skin .vjs-progress-control,
    .vjs-default-skin .vjs-time-controls,
    .vjs-default-skin .vjs-time-divider,
    .vjs-default-skin .vjs-captions-button,
    .vjs-default-skin .vjs-mute-control,
    .vjs-default-skin .vjs-volume-control,
    .vjs-default-skin .vjs-fullscreen-control {
        display: none;  
    }
    

    If you can't link your page's CSS after the video-js.css gets linked, you can use display: none !important; instead and that should do the trick. Although, I'd only use !important as a last resort.

    Note: The above does not remove the pause button once play is hit nor the big play button. There are more UI considerations when removing those. Hopefully this will help some people with customizing the Video.js control bar.

提交回复
热议问题