zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    shiro的授权与认证
    spring-aop
    GC选择之串行收集与并行收集
    4. Tomcat调优
    spring boot 启动 开启注解 加载 bean
    一、JavaScript实现AJAX(只需四步)
    DVWA安装
    CTF入门指南
    Metasploit 学习
    JSP笔记
  • 原文地址:https://www.cnblogs.com/guanliyang/p/3809682.html
Copyright © 2011-2022 走看看