开发者

iphone stop AVAudioPlayer

开发者 https://www.devze.com 2023-03-06 15:32 出处:网络
I want to stop the AVAudio开发者_如何学JAVAPlayer when click on new tab. Stop an Pause button are working properly but if i am click on new tab bar the player is to be play in background so how can i

I want to stop the AVAudio开发者_如何学JAVAPlayer when click on new tab. Stop an Pause button are working properly but if i am click on new tab bar the player is to be play in background so how can i stop the player.

I used:

-(void)stop_play
{
    [player stop];
    play.hidden=NO;
    stop.hidden=YES;
}


when you click on new tab,in your action method write code like this

if(audioPlayer.playing){
[audioPlayer stop];
}


when your AVAudioPlayer playing, set one bool var as YES.. than call stop maethod with passing this bool var.. like Code here

if(isPlay)
{
isPlay = NO;
[audioPlayer stop];
}

after than you play audio set bool var again YES...

0

精彩评论

暂无评论...
验证码 换一张
取 消