0

是的,我研究了发生了什么,但就我而言,我确信音频的格式是有效的,因为它是来自 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");
}
4

1 回答 1

0

解决了!

即使静音打开,我也会强制它播放,

moviePlayer.useApplicationAudioSession = NO;
[self presentMoviePlayerViewControllerAnimated:moviePlayer];

这就是iTunes商店在您点击它时为预览歌曲打开静音时所做的事情

于 2013-06-09T16:21:20.890 回答