yanwsh / videojs-panorama

a plugin for videojs run a full 360 degree panorama video.
http://yanwsh.github.io/videojs-panorama/
Other
492 stars 160 forks source link

Immediately play video in fullscreen on iOS #67

Closed slementin closed 7 years ago

slementin commented 7 years ago

Hello!

I want to play a panorama video directly in fullscreen mode when the user hits a button in my ionic 2 app.

So far, I have only been successful in playing fullscreen when the button is pressed in the player itself, which isn't what I'm looking for. Of course player.requestFullscreen(); only works on Android as the native iOS player is not an issue there...

So is there some alternative to player.requestFullscreen(); and player.enterFullWindow(); that works better with the way we have to handle fullscreen on iOS?

yanwsh commented 7 years ago

Hello, Try following code

button.addEventListener('click', function(){ 
     if(!player.isFullscreen()){
                player.controlBar.fullscreenToggle.trigger("tap");
     }
});
slementin commented 7 years ago

Sadly, that doesn't work for me :(

I noticed that when the user presses the fullscreen-button in the player, the state of that button doesn't seem to change. So when the player is in fullscreen mode and the user tries to close the video, it opens the native player instead of closing it. This might be my fault but I thought I'd let you know anyways.

yanwsh commented 7 years ago

Could you email the code to me? yanwsh@gmail.com

slementin commented 7 years ago

Hello again!

I managed to solve this problem by having the player take up the whole size of the screen at all times. By default it's hidden and when I need to show it (when a button is pressed) I add a class which reveals it.

This solution seems to work fine right now, but I'll update this thread if there are any problems in the future.