exit webkitfullscreen and play video inline

Viewed 37

I'm building a small video library web app targetting iOS, where the videos display in fullscreen.

I'm looking to do a Netflix style, "next video" 7 seconds before the end of the video that's playing.

To do that, I check the video currentTime against the duration and makes sure exitfullscreen hasn't already been triggered

video.addEventListener('timeupdate', () => {
                let time = video.currentTime,
                    duration = video.duration

                if (time > duration - 7 && !_exitfullscreen) {
                    video.webkitExitFullscreen()
                    _exitfullscreen = true
                    video.removeAttribute('controls')
                    video.style.height = '150px'
                    video.setAttribute('playsinline', 'playsinline')
                   
                }
            })

After setting the playsinline attribute I tried doing video.play() to restart the playback but it doesn't work. Everything else is good, other than the play method.

What am I missing?

0 Answers
Related