robnyman / robnyman.github.com

Demos
518 stars 438 forks source link

full screen auto landscape mode #24

Open colax opened 6 years ago

colax commented 6 years ago

Hi,

first thanks for the code.

How did you make video Full Screen automatically on landscape mode? It seems isnt allowed by the browser unless you trigger a click/keydown events.

robnyman commented 6 years ago

Hi,

You can't. For security reasons, it has to be triggered by a user action.

colax commented 6 years ago

So how does it work in your project? Because it is full screen on landscape with no button triggered.

And how are they doing for example in Youtube website?

robnyman commented 6 years ago

Depending on mobile OS, videos in landscape - once they have started playing - will be in fullscreen mode. But that still takes the user trigger of starting the video/pressing fullscreen or similar.

colax commented 6 years ago

Yes, first the video needs to be played.

But anyway, I'm using android 7 in my site and yours, and yours when I switch to landscape, it starts full screen. That's why I don't get it.

Could it be the player? I'm using a custom HTML5 player from Unreal Media Server developers. In the end, it is HTML5. i thought about simulate a click or keydown but it doesnt work neither.

That's why I'm quite interested in your solution :)

robnyman commented 6 years ago

I think it's rather the default operating system, and since my code just use the basic APIs to do it. It could rather be that, as a side effect, some of the more complex players' implementation then block that native behavior.