是的,我正在研究发生了什么,但在我的情况下,我确信音频的格式是有效的,因为它是来自itunes商店预览的m4a文件,我的4s设备播放没有任何问题。
任何提示都表示赞赏
-(IBAction)StartMusic
{
NSLog(@"start");
NSURL *songUrl = [NSURL URLWithString:@"http://a1804.phobos.apple.com/us/r1000/064/Music/v4/9b/b3/c7/9bb3c7dc-a06f-f18c-3e41-2ce1e36f73b4/mzaf_7432104896053262141.aac.m4a"];
MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:songUrl];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:nil];
[mp setControlStyle:MPMovieControlStyleFullscreen];
[mp setMovieSourceType:MPMovieSourceTypeStreaming];
[mp setFullscreen:YES];
[mp.view setFrame: self.view.bounds];
[self.view addSubview:[mp view]];
[mp prepareToPlay];
[mp play];
NSLog(@"start 2");
}
答案 0 :(得分:0)
解决!
即使打开静音,我也强迫它播放,
moviePlayer.useApplicationAudioSession = NO;
[self presentMoviePlayerViewControllerAnimated:moviePlayer];
这就是当你点击预览歌曲时静音开启时itunes商店所做的事情