音频播放协议AVAudioPlayerDelegate 函数简介

/* audioPlayerBeginInterruption: is called when the audio session has been interrupted while the player was playing. The player will have been paused. */

//产生中断后调用这个函数,通常暂停播放

- (void)audioPlayerBeginInterruption:(AVAudioPlayer *)player

{

    [self.playerpause];

}


/* audioPlayerEndInterruption:withOptions: is called when the audio session interruption has ended and this player had been interrupted while playing. */

/* Currently the only flag is AVAudioSessionInterruptionFlags_ShouldResume. */

//恢复中断后调用这个函数,继续播放

- (void)audioPlayerEndInterruption:(AVAudioPlayer *)player withOptions:(NSUInteger)flags

{

    [self.playerplay];

}


//解码出错后调用这个函数

- (void)audioPlayerDecodeErrorDidOccur:(AVAudioPlayer *)player error:(NSError *)error


//播放结束后调用这个函数

- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag


发布了91 篇原创文章 · 获赞 4 · 访问量 17万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览