在iPhone的声音停止 [英] stop sound in iPhone
本文介绍了在iPhone的声音停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
SystemSoundID soundID;
NSString *path = [[NSBundle mainBundle] pathForResource:@"static" ofType:@"caf"];
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:path], &soundID);
AudioServicesPlaySystemSound(soundID);
我在上面已经code在我的应用程序实现的。
I have implemented above code in my application.
它完美,
但问题是我不知道如何阻止它。
But the problem is I don't know how to stop it.
即声音是10秒。
10秒之前。如果用户点击按钮,声音应该被停止?
Before 10 sec. if user taps button, sound should be stopped?
如何?
先谢谢了。
萨加尔
推荐答案
尝试AudioServicesDisposeSystemSoundID,它停止声音立刻。你需要重新创建的声音,如果你打算再次使用它。
Try AudioServicesDisposeSystemSoundID, it stops sounds immediately. You'll need to recreate the sound if you intend to use it again.
这篇关于在iPhone的声音停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文