admin管理员组

文章数量:1330576

Hello guys I have got custom fullscreen icon that triggers fullscreen on my video. Everything is ok except that it doesn't work on Apple's devices. Do you know how to fix that?

$('.fullscreen_btn').click(function() {
    fullscreen=true;
    var mediaElement = document.getElementById('videoAbout');
    if(mediaElement.requestFullScreen) {
        mediaElement.requestFullScreen();
    }
    else if(mediaElement.webkitRequestFullScreen) {
        mediaElement.webkitRequestFullScreen();
    }
    else if(mediaElement.mozRequestFullScreen) {
        mediaElement.mozRequestFullScreen();
    }
    else if(mediaElement.msRequestFullScreen) {
        mediaElement.mozRequestFullScreen();
    }
});

As I said - code above is working on Windows/android devices, but not on Apple's.

Hello guys I have got custom fullscreen icon that triggers fullscreen on my video. Everything is ok except that it doesn't work on Apple's devices. Do you know how to fix that?

$('.fullscreen_btn').click(function() {
    fullscreen=true;
    var mediaElement = document.getElementById('videoAbout');
    if(mediaElement.requestFullScreen) {
        mediaElement.requestFullScreen();
    }
    else if(mediaElement.webkitRequestFullScreen) {
        mediaElement.webkitRequestFullScreen();
    }
    else if(mediaElement.mozRequestFullScreen) {
        mediaElement.mozRequestFullScreen();
    }
    else if(mediaElement.msRequestFullScreen) {
        mediaElement.mozRequestFullScreen();
    }
});

As I said - code above is working on Windows/android devices, but not on Apple's.

Share Improve this question asked Dec 16, 2016 at 10:37 user7289982user7289982 2
  • It works on Mac - That's a apple devices so what's the problem? Maybe you should say iOS next time... – Endless Commented Dec 16, 2016 at 10:42
  • Sorry, problem is existing on iPhone and iPad – user7289982 Commented Dec 16, 2016 at 11:37
Add a ment  | 

2 Answers 2

Reset to default 7

I sloved my question. All i had to do is that:

var mediaElement = document.getElementById('videoAbout');
mediaElement.webkitEnterFullscreen();
mediaElement.enterFullscreen();

This is opening fullscreen on HTML5 video on iOS devices.

Quoting directly from the website

In Safari, the built-in video controls include a play/pause button, volume control, and a time scrubber. In Safari 5.0 and later on the desktop and on iOS 4.2 on the iPad, the controls also include a full-screen playback toggle on the lower right. The controls automatically fade out when the video is playing and fade in when the user hovers over the video or touches it.

I also says If you embed audio or video in your website, you should use HTML5. you might be using old html4, I don't know. Try this link

本文标签: javascriptRequest HTML5 video fullscreen on Apple39s devicesStack Overflow