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

There are 1 answers

0
ArkReversed On BEST ANSWER

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).