AVFoundation --- 01入门

2019-11-09  本文已影响0人  亡灵诅咒

AVFoundation --- 01入门

目标

解析框架,了解相关的功能和特性。媒体相关知识

解析AVFoundation

一 AVFoundation在整个体系中所处的角色! 1c08ff3e7f46e8099fa41eaa013f287b05245be151de2b8794126d4f11ba81ae.png

二 主要的支撑框架以及提供的功能

三 解析AVFoundation

数字媒体

将模拟信号转换成能够存储并传输的数字信号,要进过模拟-数字转换过程,这个过程成为采样(Sampling)

音频采样

数据媒体采样

数字媒体压缩

色彩二次抽样

编解码器压缩

视频编解码器

音频编码解码器

文本到语音

    AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:string];
    utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"zh-CN"];
    utterance.rate = 0.5;
    utterance.pitchMultiplier = 1.0;
    utterance.volume = 0.5;
    utterance.postUtteranceDelay = 0.5;
    utterance.preUtteranceDelay = 0.5;

代理监听

  方法名称很容易理解,就不做介绍了
- (void)speechSynthesizer:(AVSpeechSynthesizer *)synthesizer didStartSpeechUtterance:(AVSpeechUtterance *)utterance API_AVAILABLE(ios(7.0), watchos(1.0), tvos(7.0), macos(10.14)){

}

- (void)speechSynthesizer:(AVSpeechSynthesizer *)synthesizer didFinishSpeechUtterance:(AVSpeechUtterance *)utterance API_AVAILABLE(ios(7.0), watchos(1.0), tvos(7.0), macos(10.14)){

}

- (void)speechSynthesizer:(AVSpeechSynthesizer *)synthesizer didPauseSpeechUtterance:(AVSpeechUtterance *)utterance API_AVAILABLE(ios(7.0), watchos(1.0), tvos(7.0), macos(10.14)){

}

- (void)speechSynthesizer:(AVSpeechSynthesizer *)synthesizer didContinueSpeechUtterance:(AVSpeechUtterance *)utterance API_AVAILABLE(ios(7.0), watchos(1.0), tvos(7.0), macos(10.14)){

}

- (void)speechSynthesizer:(AVSpeechSynthesizer *)synthesizer didCancelSpeechUtterance:(AVSpeechUtterance *)utterance API_AVAILABLE(ios(7.0), watchos(1.0), tvos(7.0), macos(10.14)){

}

- (void)speechSynthesizer:(AVSpeechSynthesizer *)synthesizer willSpeakRangeOfSpeechString:(NSRange)characterRange utterance:(AVSpeechUtterance *)utterance API_AVAILABLE(ios(7.0), watchos(1.0), tvos(7.0), macos(10.14)){

}

注意点
AVSpeechSynthesisVoice 类提供API来获取锁支持的语言。设置语言时做下容错处理

[AVSpeechSynthesisVoice speechVoices];
上一篇下一篇

猜你喜欢

热点阅读