How to change the position of videojs Control bar elements order

三世轮回 提交于 2020-08-05 04:31:25

问题


I am using the video.js player for my website. I want to change the position of control bar elements.

Presently, it shows play/pause, volume, progress bar and full screen.

How can I able to change order?

I have my code below:

var videojs = videojs('video-player', {
    techOrder:  ["youtube", "html5"],
    preload: 'auto',
    controls: true,
    autoplay: true,
    fluid: true,
    controlBar: {
        CurrentTimeDisplay: true,
        TimeDivider: true,
        DurationDisplay: true
    },
    plugins: {
        videoJsResolutionSwitcher: {
            default: 'high',
            dynamicLabel: true
        }
    }
}).ready(function() {
    var player = this;
   ......

回答1:


I could able resolve by making changes as below:

    var videojs = videojs('video-player', {
    techOrder:  ["youtube", "html5"],
    preload: 'auto',
    controls: video.player.controls,
    autoplay: video.player.autoplay,
    fluid: true,
    controlBar: {
        children: [
            "playToggle",
            "volumeMenuButton",
            "durationDisplay",
            "timeDivider",
            "currentTimeDisplay",
            "progressControl",
            "remainingTimeDisplay",
            "fullscreenToggle"
        ]
    },
    plugins: {
        videoJsResolutionSwitcher: {
            default: 'high',
            dynamicLabel: true
        }
    }
}).ready(function() {
    var player = this;

I thought it will help somebody in future.

Taken idea from JS Bin



来源:https://stackoverflow.com/questions/45727017/how-to-change-the-position-of-videojs-control-bar-elements-order

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!