zhw2590582 / ArtPlayer

:art: ArtPlayer.js is a modern and full featured HTML5 video player
https://artplayer.org
MIT License
2.49k stars 264 forks source link

Auto full-screen on video start #730

Closed jedgarf closed 5 months ago

jedgarf commented 5 months ago

how to auto full-screen when the video is ready

zhw2590582 commented 5 months ago

Due to the browser security mechanism, there must be interaction on the page (for example, the user has clicked on the page) before triggering the window to go full screen.

var art = new Artplayer({
    container: '.artplayer-app',
    url: '/assets/sample/video.mp4',
});

art.on('ready', () => {
    art.fullscreen = true;
    // art.fullscreenWeb = true;
})
jedgarf commented 5 months ago

thank you