youtube / youtube-ios-player-helper

Lightweight helper library that allows iOS developers to add inline playback of YouTube videos through a WebView
Other
1.65k stars 683 forks source link

Exit fullscreen mode when rotating back to portrait #74

Open Kowaio opened 9 years ago

Kowaio commented 9 years ago

Hello everybody,

I hope this post is not redundant but I think that a lot of people are trying to get the same behavior as the following.

I'm trying to do the same thing that the Youtube iOS app. When the user taps the fullscreen button inside the YTPlayerView, I managed to rotate the device in landscape mode, like Youtube iOS does. However, when rotating back to portrait mode, I would like the YTPlayerView to close the fullscreen (also like Youtube iOS). I still can't figure a way to do that properly.

The only hint I've got so far is by using the reload method on the UIWebView of the player. It will force the UIWebView to reload and therefore will close the fullscreen. However, this reload method doesn't work very well and just closes the fullscreen, but the video doesn't keep going.

Since this way is more a less a hack, do you know how could that be possible using this library? Or are there other libraries to use embed youtube video to play inline but also in fullscreen that behave properly, like in the Youtube iOS app?

Thanks a lot for your feedback,

K

thiemdv commented 9 years ago

Hi, Did you find the solution? Can you share the way you do to rotate the device in landscape when user taps fullscreen button please?

Thanks a lot.

Kowaio commented 9 years ago

Hello,

I didn't find a solution. I just changed the frame of the playerView when rotating the device. If the user is in fullscreen mode and turns the device, it will stay in fullscreen while rotating but I can't close this mode programmatically.

Best,