I'm working on an app that allows users to play videos from YouTube inside a UIWebView. The videos play fine on the device, but I'm having issues when attempting to AirPlay CERTAIN videos from my UIWebView. Basically, there are some videos that will consistently fail to AirPlay - and I get an error message on my AppleTV - "An error occurred loading this content. Try again later" ... The device logs reveal this error:
_itemFailedToPlayToEnd: {
AVPlayerItemFailedToPlayToEndTimeErrorKey = "Error Domain=AVFoundationErrorDomain Code=-11800 \"The operation could not be completed\" UserInfo=0x170a7a9c0 {NSUnderlyingError=0x17064b1c0 \"The operation couldn\U2019t be completed. (OSStatus error -12926.)\", NSLocalizedFailureReason=An unknown error occurred (-12926), NSLocalizedDescription=The operation could not be completed}";
The console logs on my device show this when attempting to make an AirPlay connection:
Connected to address: 10.1.5.30:5000
Connected to endpoint: "Apple TV" at 10.1.5.30:5000 (from 10.1.7.233:58375)
Audio pair-verify: 10.1.5.30:5000
### Pair-verify failed: -6743/0xFFFFE5A9 kSizeErr
### Audio pair-verify failed: -6743/0xFFFFE5A9 kSizeErr
Re-pair-setup with "Apple TV"
Audio pair-Setup: 10.1.5.30:5000
### Pair-setup failed: -6743/0xFFFFE5A9 kSizeErr
### Audio pair-setup failed: -6743/0xFFFFE5A9 kSizeErr
Disconnected from 10.1.5.30:5000
Here are some example YouTube videos that will NOT AirPlay from a UIWebView with iframe embed (my apologies for the content):
http://www.youtube.com/watch?v=KQ6zr6kCPj8 http://www.youtube.com/watch?v=CevxZvSJLk8
I'm looking for any help or ideas for a workaround. Thanks!
EDIT: I would like to also say that I can AirPlay these "problem" videos with success to third-party AirPlay implementations such as AirServer.