youtube / youtube-ios-player-helper

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

Youtube Player on iOS 16 show Black Screen only #477

Closed christinachanhk closed 1 year ago

christinachanhk commented 1 year ago

We are using Youtube Player on iOS 15 for a long time and that works fine. But once the device had been updated to iOS 16, the player will only play video with black screen (no image will be shown).

Please help.

denkeni commented 1 year ago

No issue in my case. Do you have a reproducible example project?

christinachanhk commented 1 year ago

Thank you for confirming that is not an issue related to the library.

As we will play YouTube automatically in full screen mode, so the YTPlayerView is set to be 0 width and height, may be that is considered as to hide the player view even in full screen mode which cause a black screen as result.

To fix this, we simply set some value for the width and height and set the view to be hidden.

abhi7054 commented 1 year ago

@christinachanhk I'm facing the same issue. Setting the width and height worked. But did you manage to play the video in fullscreen? Appreciate your help.

christinachanhk commented 1 year ago

To play with fullscreen, just set "playerVars" with "playsinline" will be fine.

playerView.load(withVideoId: "M7lc1UVf-VE",
                        playerVars: ["playsinline": 0])
christinachanhk commented 1 year ago

Please refer to the link "YouTube Embedded Players and Player Parameters" for your reference: https://developers.google.com/youtube/player_parameters

Despite of they mentioned "playsinline" default value should be "0" which refer to "Results in fullscreen playback", seems we need to set that explicitly.

abhi7054 commented 1 year ago

That's exactly what I have done but when the video goes fullscreen the video stops showing and only the audio plays.

garciajg commented 1 year ago

@abhi7054 did you ever resolve this issue?