Video.js enter fullscreen on play

前端 未结 4 956
星月不相逢
星月不相逢 2021-01-01 03:18

I\'ve been searching around for a long time but still haven\'t found a valid solution for my problem. I just cant seem to get the video player to enter fullscreen. The API d

4条回答
  •  Happy的楠姐
    2021-01-01 03:55

    in video.js file go to this lines

    BigPlayButton.prototype.handleClick = function handleClick(event) {
    
            var playPromise = this.player_.play();
    

    and add

    BigPlayButton.prototype.handleClick = function handleClick(event) {

            var playPromise = this.player_.play();
            document.getElementsByClassName('vjs-fullscreen-control')[0].click()
            // exit early if clicked via the mouse
            if (this.mouseused_ && event.clientX && event.clientY) {
                silencePromise(playPromise);
                return;
            }
    

提交回复
热议问题