0
我想用下面的代碼播放audiio,但沒有播放。任何形式的幫助將非常感激。avplayer不能在IOS中播放音頻
NSError *sessionError = nil;
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionMixWithOthers error:&sessionError];
[[AVAudioSession sharedInstance] setActive: YES error: nil];
AVPlayerItem *item = [AVPlayerItem playerItemWithURL:[NSURL URLWithString:audioUrl]];
[self setPlayer:[[AVPlayer alloc] initWithPlayerItem:item]];
[[self player] setActionAtItemEnd:AVPlayerActionAtItemEndNone];
[[self player] play];
我試圖在模擬器.. – Rafay 2014-09-03 21:42:51
解決通過添加#進口。 –
Rafay
2014-09-03 22:13:13