在iPhone中停止声音
发布时间:2020-12-14 17:44:46 所属栏目:百科 来源:网络整理
导读:SystemSoundID soundID;NSString *path = [[NSBundle mainBundle] pathForResource:@"static" ofType:@"caf"]; AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:path],soundID);AudioServicesPlaySystemSound(soundID); 我在我的应用程
SystemSoundID soundID; NSString *path = [[NSBundle mainBundle] pathForResource:@"static" ofType:@"caf"]; AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:path],&soundID); AudioServicesPlaySystemSound(soundID); 我在我的应用程序中实现了上面的代码. 它运作完美,但问题是我不知道如何阻止它. 即声音为10秒. 10秒之前如果用户点击按钮,应该停止声音?我怎么能这样做? 解决方法
尝试AudioServicesDisposeSystemSoundID,它立即停止声音.如果您打算再次使用它,则需要重新创建声音.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |