views:

456

answers:

2

I am playing MP3 audio via a URL using the MPMoviePlayer. But when it plays, it flips to Landscape layout, and I would like it to remain in portrait layout.

Any ideas?

Thanks, John

A: 

Unfortunately, the movie player can only play movies in Landscape. You'll have to reencode your movies rotated to 480x320 instead of 320x480. After you play the movie, it changes the status bar's orientation, so you need to flip that back with setStatusBarOrientation:animated::

[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO];
Adam Rosenfield
That's what I was afraid of. Unfourtunatly I can't re-encode to 480x320, because it is an MP3 file and not a movie file. One solution I came up with was to encode it as a movie, but that's not a viable solution for me.Thanks for your reply.
postalservice14
Then why are you using the MPMoviePlayer? Instead just use something from the audio toolbox; see http://developer.apple.com/iphone/library/navigation/Frameworks/Media/AudioToolbox/index.html .
Adam Rosenfield
A: 

You could use an ugly hack and place it in a UIWebView, but this functionality really should be in MPMoviePlayer.