1
votes

I am developing a music app that plays audio, regular video (such as mp4) and youtube videos. It has the proper background mode enabled, as the app plays audio and regular video correctly in the background.

The following issue appears only on the iPad, not on the iPhone.

Using the YouTube-Player-iOS-Helper on iOS 8, adding the youtube video content (YTPlayerView) to another view (as a subview) works great, even when playing. However, removing that YTPlayerView from its superview automatically pauses the playback, which isn't always the desired case (sending the app to the background causes the same effect).

Is it possible to change that behaviour?

I can rationalize manually resuming the playback when the app goes to the background, however, doing the same for the 'remove from superview scenario' causes the playback to stutter for a moment.

The issue can easily be reproduced with the sample app for 'YouTube-Player-iOS-Helper', by playing a video and then changing between tabs. On the iPhone, the player does NOT pause, but on the iPad, the player DOES pause.

If it's impossible, is there other Youtube SDKs that allow this behaviour and still adhere to the official terms and conditions?

Thanks

1
Have you followed these steps? stackoverflow.com/a/20181026/4657588user4657588
Yes, the proper background mode is enabled. Edited that to the question.ArkReversed
Do you get any state playback changes using the state change delegate method?JAL
I get a callback indicating the player changed it's state to paused. Using that I can manually resume playback, however, the stutter is noticeable.ArkReversed

1 Answers

2
votes

Figured this one.

The YTPlayerView will NOT pause, on iPad or iPhone, if you remove it from its superview and immediately add it to a view again (can be a different view). That view must be inside a view controller properly rooted in the view hierarchy (not detached).