plyr icon indicating copy to clipboard operation
plyr copied to clipboard

Request : force fullscreen in landscape on mobile devices

Open r4dius opened this issue 7 years ago • 13 comments

  • [x] Issue does not already exist
  • [ ] Issue observed on https://plyr.io

Expected behaviour

Not sure if it should be a default behaviour but when using the chrome player fullscreen button we get the video forced in landscape mode which is nice, same thing with the youtube app, even if you don't enable landscape or auto rotation on the device, in plyr there's no way to force landscape fullscreen like that

  • Browser: Chrome
  • Version: 52
  • Operating System: Android
  • Version: 7.1.1

Players affected:

  • [x] HTML5 Video
  • [ ] HTML5 Audio
  • [ ] YouTube
  • [ ] Vimeo

Steps to reproduce

  • Click fullscreen when device is in portrait

Relevant links

r4dius avatar May 14 '17 16:05 r4dius

Good idea. Will look into it... 👍

sampotts avatar Jun 05 '17 22:06 sampotts

Yes. I've been looking solutions for that Mobile Orientation. By default behaviour using <video src="somelink" allowfullscreen > that allowfullscreen works perfectly when pressed for fullscreen, automatically landscape orientation for mobile. We need this feature ASAP ! . Also, I've been thinking using eventlistener for orientationchange where a device is using mobile size.

ammein avatar Aug 22 '18 10:08 ammein

@ammein Get a pull request in 👍

sampotts avatar Aug 22 '18 10:08 sampotts

@ammein I tried doing that but in vain. Any other suggestions?

masteroogway97 avatar Jul 01 '19 06:07 masteroogway97

I am wait for next version

Reqrefusion avatar Oct 01 '19 14:10 Reqrefusion

Okay, so after forgetting about this just found an easy way to get this working, I'm using some code on my custom javascript not tested to add to plyr yet, When fullscreen toggling is done just force "landscape", this will align on the actual landscape orientation : $(document).on('webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange', function() { if(plyr.fullscreen.active) { screen.orientation.lock("landscape"); } else { screen.orientation.unlock(); } }

Would need to be disabled if height > width

r4dius avatar Jan 09 '20 00:01 r4dius

Looks like there's no support in Safari: https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation/lock

But we can always add this in...

sampotts avatar Feb 09 '20 22:02 sampotts

But we can always add this in...

Just a reminder to please add this in so that Plyr can be on par with the normal html5 player in Android Chrome.

nitaaikumar avatar May 22 '20 16:05 nitaaikumar

Looks like there's no support in Safari: https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation/lock

But we can always add this in...

Any progress yet?

CodeDruid13 avatar Jun 21 '20 04:06 CodeDruid13

No updates on this one yet?!

aradalvand avatar Dec 10 '20 15:12 aradalvand

No updates on this one yet?!

jawahar95 avatar Feb 15 '21 13:02 jawahar95

No pull requests yet?!

sampotts avatar Feb 15 '21 20:02 sampotts

var winwidth=$(window).width();
            var winheight=$(window).height();

            const player = Plyr.setup('#player');
            player.forEach (item => {

                item.on('enterfullscreen', event => {

                 $(".plyr__video-wrapper").css({"transform": "rotate(90deg)", "height": winwidth, "width": winheight, "margin-left": "0px", "margin-right": "0px"});
                })
                item.on('exitfullscreen', event => {
                 $(".plyr__video-wrapper").css({"transform": "rotate(0deg)", "height": "100%", "width": "100%", "margin-left": "auto", "margin-right": "auto"});
                })
            });

I also faced the same problem. And that's how I did it, it works very nicely!

mert-ozkul avatar Jan 28 '22 10:01 mert-ozkul

I have same problem , you ca help me ?

Plyr

Bikoubikou avatar Feb 20 '23 02:02 Bikoubikou