Skip to main content
Known Participant
Sep 30, 2022 2:11 PM UTC
Answered

How to make fullscreen view directly (HTML5)

How to make fullscreen directly when I test movie in animate CC ?

I try this script, but it seems doesnt work :

//here's the code

this.on("tick", full.bind(this));

var ancs = 0

function full(e) {
fullscreen()
}

var isInFullScreen = (document.fullscreenElement && document.fullscreenElement !== null) ||
(document.webkitFullscreenElement && document.webkitFullscreenElement !== null) ||
(document.mozFullScreenElement && document.mozFullScreenElement !== null) ||
(document.msFullscreenElement && document.msFullscreenElement !== null);

var docElm = document.documentElement;

function fullscreen() {

if (!isInFullScreen) {
if (docElm.requestFullscreen) {
docElm.requestFullscreen();
} else if (docElm.mozRequestFullScreen) {
docElm.mozRequestFullScreen();
} else if (docElm.webkitRequestFullScreen) {
docElm.webkitRequestFullScreen();
} else if (docElm.msRequestFullscreen) {
docElm.msRequestFullscreen();
}

}
}

//end of code

I need some help, please...

    This topic is closed to new replies. Start a new post to keep the conversation going.
    kglad
    kgladCorrect answer
    Community Expert
    Sep 30, 2022 2:55 PM UTC

    you can't do that. (thankfully) browsers prevent that.  you must have user interaction with a browser displayed stage.

    5 replies

    kglad
    Community Expert
    Community Expert
    Sep 30, 2022 2:31 PM UTC

    put something on stage to click (it can have alpha = 0).

     

    and you probably want to edit your publish settings to center your stage and possibly make your stage responsive and fit.  ie, test the various settings to get the effect you want.

    Translate
    Known Participant
    Sep 30, 2022 2:49 PM UTC

    Hi, Kglad...

    I want my project directly in fullscreen view, without any click of button. The 'tick' function seems not working.

    Translate
    kglad
    Community Expert
    kgladCommunity ExpertCorrect answer
    Community Expert
    Sep 30, 2022 2:55 PM UTC

    you can't do that. (thankfully) browsers prevent that.  you must have user interaction with a browser displayed stage.

    Translate