IOS 播放音频
1,播放短音频
#import <AudioToolbox/AudioToolbox.h>
#import "GLYViewController.h"
static void completionCallback(SystemSoundID mySSID)
{
AudioServicesPlaySystemSound(mySSID);
}
@interface GLYViewController ()
@end
@implementation GLYViewController
SystemSoundID crash;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSURL* crashUrl = [[NSBundle mainBundle] URLForResource:@"crash"
withExtension:@"wav"];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)crashUrl, &crash);
AudioServicesAddSystemSoundCompletion(crash, NULL, NULL, (void *)completionCallback, NULL);
}
- (IBAction)play:(id)sender {
AudioServicesPlayAlertSound(crash);
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
IOS 播放音频的更多相关文章
- iOS 播放音频的几种方法
Phone OS 主要提供以下了几种播放音频的方法: System Sound Services AVAudioPlayer 类 Audio Queue Services OpenAL 1. Syst ...
- IOS播放音频 AVAudioPlayer(实例)
1. AVFoundation Build Phases => Link Binary With Libraies => + => AVFoundation.framework =& ...
- IOS 播放音频流媒体
#pragma mark - 加载播放数据 - (void)loadData:(NSString *)musicUrl { NSURL *playURL = [NSURL URLWithString: ...
- iOS 播放音频文件
// 播放音乐 NSString *path = [[NSBundle mainBundle] pathForResource:@"1670" ofType:@&qu ...
- iOS开发----音频播放、录音、视频播放、拍照、视频录制
随着移动互联网的发展,如今的手机早已不是打电话.发短信那么简单了,播放音乐.视频.录音.拍照等都是很常用的功能.在iOS中对于多媒体的支持是非常强大的,无论是音视频播放.录制,还是对麦克风.摄像头的操 ...
- iOS 微信 音频 视频自动播放
iOS 微信 音频 视频自动播放 http://www.w3ctech.com/topic/1165
- ios不触发事件也能播放音频
ios不触发事件也能播放音频. 首先界面初始化预加载一个没有声音的音频,代码如下: html: js: $(function(){ $("#start_audio")[0].pla ...
- iOS 9音频应用播放音频之iOS 9音频播放进度
iOS 9音频应用播放音频之iOS 9音频播放进度 iOS 9音频应用开发播放进度 音频文件在播放后经过了多久以及还有多久才可以播放完毕,想必是用户所关注的问题.为了解决这一问题,在很多的音乐播放器中 ...
- iOS 9音频应用播放音频之控制播放速度
iOS 9音频应用播放音频之控制播放速度 iOS 9音频控制播放速度 iOS9音频文件在播放时是以一定的速度进行的.这个速度是可以进行更改的,从而实现iOS9音频文件的快速播放和慢速播放功能.要实现i ...
随机推荐
- pl/sql developer 编码格式设置(转)
一.pl/sql developer 中文字段显示乱码 原因:因为数据库的编号格式和pl /sql developer的编码格式不统一造成的. 二.查看和修改oracle数据库字符集: select ...
- JavaScript之向文档中添加元素和内容的方法
一.非DOM方法添加 1.document.write() <html xmlns="http://www.w3.org/1999/xhtml"> <head&g ...
- 性能优化工具---sar
简介: System Activity Reporter系统活动情况报告 下载地址: http://pagesperso-orange.fr/sebastien.godard/download.htm ...
- bootstrap2.3.2常用标签的使用
<!DOCTYPE html> <html lang="zh_CN"> <head> <title>Bootstrap 101 Te ...
- XX cannot be resolved to a type
http://www.cnblogs.com/xuxm2007/archive/2011/10/20/2219104.html 我是project->clean...即可 原理:将工程中的.cl ...
- iOS 导航条的影响
如果是push出来的控制器,self.view的(0,0)点从状态栏下面开始: 如果有present出来的控制器,self.view的(0,0)点包含状态栏:
- Problem B: 最少步数
DescriptionA friend of you is doing research on theTraveling Knight Problem (TKP) where you are to f ...
- [非技术参考]C# Socket网络编程
我们在讲解Socket编程前,先看几个和Socket编程紧密相关的概念: 1. TCP/IP层次模型 当然这里我们只讨论重要的四层 01,应用层(Application):应用层是个很广泛的概念,有一 ...
- .Net 类型、对象、线程栈、托管堆运行时的相互关系
JIT(just in time)编译器 接下来的会讲到方法的调用,这里先讲下JIT编译器.以CLR书中的代码为例(手打...).以Main方法为例: static void Main(){ Cons ...
- 5.7.2.4 random() 方法
Math.random()方法返回大于等于0小于1的一个随机数.对于某些站点来说,这个方法非常实用,因为可以利用它来随机显示一些名人名言和新闻事件.套用下面的公式,就可以利用Math.random() ...