简体   繁体   中英

control audio play in background

I have a tablewview and by click a table row a subview appear as player and play audio in my app . I added play in background mode and controls it while in background , it works .

The problem I have is , when I move to another view (exactly when the subview being disappear) I can't control or stop the audio.

how can I let the controls keep detect the audio playing while I'm in any other views of my app? also how can I let the subview appear when I back to my view again to allow stop or show the progress status?

I hope anybody can help

You will have to keep a Strong reference to your view, or, at least, to your object currently playing a sound.

I'll suggest using a protocol between viewControllers to let the parent view controller catch the reference before dismissing the view containing the player.

You'll find much more explanation at Ray Wenderlich website's Audio playing tutorial.

Please see the above link to find this solution and must read "Comment"... :)

Playing music in background ios app

another link may help you... iOS SDK : playing music on the background and switching views

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM