New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to toggleFullScreen when window orientation? #484
Comments
|
A gesture restriction means that the API can only be triggered in an event
handler for an event such as a click. It has to be directly called by the
handler. AngularJS event directives, for example tend to not work.
On Nov 12, 2017 6:58 AM, "huxiaozhong" <notifications@github.com> wrote:
Description
how to toggleFullScreen when window orientation?
in window.addEventListener ,this controller.API.toggleFullScreen(); cant
work,console log:
but in $scope.stateChange it can work!!!! why ,how to fix it?
Failed to execute 'requestFullscreen' on 'Element': API can only be
initiated by a user gesture.
Live Demo
window.addEventListener("onorientationchange" in window ?
"orientationchange" : "resize", function () { if ((window.orientation ===
90 || window.orientation === -90) && controller.API !== null &&
controller.API.currentState === "play" && !controller.API.isFullScreen) {
controller.API.toggleFullScreen(); } }, false); $scope.stateChange =
function (state) { if ((window.orientation === 90 || window.orientation ===
-90) && controller.API !== null && state === "play" &&
!controller.API.isFullScreen) { controller.API.toggleFullScreen(); } }
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#484>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AE0hHklsI0oR49ZWVyRiNOc0HDC6eSQ-ks5s1t1vgaJpZM4Qa2k0>
.
|
|
i khonw this now, but how fix my problem? how to toggleFullScreen when window orientation? |
|
Actually spent some time experimenting with this during the last week. Some observations:
In summary, the browser vendors (and Apple in particular) go out of their way to cripple the browser experience. Not too difficult to read between the lines to see that they're trying to steer you into native apps. Some of these restrictions are loosened up when running through a native app context. While they did enable inline playback, it seems they did so chiefly with the animated gif replacement use case in mind. |
|
Hey there |
Description
how to toggleFullScreen when window orientation?
in window.addEventListener ,this controller.API.toggleFullScreen(); cant work,console log:
Failed to execute 'requestFullscreen' on 'Element': API can only be initiated by a user gesture.
but in $scope.stateChange it can work!!!! why ,how to fix it?
Live Demo
window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", function ()
{
if ((window.orientation === 90 || window.orientation === -90)
&& controller.API !== null
&& controller.API.currentState === "play"
&& !controller.API.isFullScreen)
{
controller.API.toggleFullScreen();
}
}, false);
$scope.stateChange = function (state)
{
if ((window.orientation === 90 || window.orientation === -90)
&& controller.API !== null
&& state === "play"
&& !controller.API.isFullScreen)
{
controller.API.toggleFullScreen();
}
}
The text was updated successfully, but these errors were encountered: