disabling play/pause in embedded video using JW player

后端 未结 3 951
滥情空心
滥情空心 2021-01-06 15:23

I am using JW (v 5.8) player to embed a video. And I want to do it so that autostart is enabled, allowing the video to start playing as soon as the page loads, the controlba

3条回答
  •  [愿得一人]
    2021-01-06 15:39

    You can use the CSS property pointer-events on the #mediaplayer to prevent the click event to go trough to the video:

    #mediaplayer {
        pointer-events: none;
    }
    

    You could also abuse the onPause event as a fallback for older browsers , by saying; play the video if the pause event is executed:

    jwplayer('mediaplayer').setup({
        flashplayer: 'player.swf',
        file: 'video.mp4',
        controlbar: 'none',
        width: '1000',
        height: '1000',
        autostart: 'true',
        events: {
            onPause: function() {
                this.play(true);
            }
        }
    });
    

提交回复
热议问题