Airplay: Playing a Movie from MPMoviePlayerController results in only audio being streamed to Apple tv
Setting up Airplay was easy enough.
self.moviePlayer = [[[MPMoviePlayerViewController alloc] initWithContentURL:url] autorelease];
[self.moviePlayer setAllowsAirPlay:YES];
However, when I try to play a video, only the audio is streamed. The video continues to play on the iPad. Additionally, the Airplay control only shows the "Audio Only" icon in the source list. (see photo).
This makes me think that iOS "thinks" that only audio is playing. I have several other apps with Airplay on my device and开发者_开发知识库 they work correctly. I have cycled both the Apple tv and the iPad on and off. Both the iPad and the Apple tv have the latest OS installed. The video is being progressively downloaded, but it plays perfectly on the iPad. Any ideas?
Airplay Supported formats include (via Apple):
- H.264 video with AAC audio HTTP
- streaming, both live and on demand
- progressive download content
- local content
For web-based content, you can enable AirPlay Video in the QuickTime Plug-in or HTML5 video element as follows:
QTPlug-in:
airplay="allow"
airplay="deny" (Default)
For example: <embed src="movie.mov" width="320" height="240" airplay="allow">
HTML5 video element:
x-webkit-airplay="allow"
x-webkit-airplay="deny" (Default)
Make sure the iOS in use is 4.3 or later. 4.2.x did respond to the -setAllowsAirPlay call, but it really didn't work properly. 4.3 is the iOS version that officially supports AirPlay. I saw this audio-only bug when testing with 4.2.x devices.
So the unattractive answer is that iOS 5 solves these issues.
I have found that certain combinations of OSs and devices cause this issue: specifically iOS 4 with an iPhone 4.
So if you are having problems, install iOS 5. As of this post, there was a recent article quoting an Apple statement announcing that iOS 5 has a penetration of about 30% of eligible devices (3Gs and above). Since it has only been 1 week since its release, I am less concerned about solving the edge cases like the one I have stated above.
This was clearly a bug in the iOS 4 version of Airplay, and it is unlikely that the iOS 4 version will be updated to fix the bug at this point. So I am calling it case closed for now.
精彩评论