9
2013-09-30 1 GeckoWeb Speech APIまわり Gecko勉強会 taken

GeckoのWeb Speech APIまわり

Embed Size (px)

Citation preview

Page 1: GeckoのWeb Speech APIまわり

2013-09-30 1

GeckoのWeb Speech APIまわり

Gecko勉強会taken

Page 2: GeckoのWeb Speech APIまわり

2013-09-30 2

自己紹介

● @Takenspc● 仕事:Webアクセシビリティ● 好みのタイプ:ゴジラよりは恐竜

Page 3: GeckoのWeb Speech APIまわり

2013-09-30 3

Web Speech API

https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html

Page 4: GeckoのWeb Speech APIまわり

2013-09-30 4

Web Speech APIとは

● W3CのSpeech API Community Groupで議論– Working Groupへ移行という話も

● API– 音声認識(SpeechRecognition)

var recognition = new SpeechRecognition();recognition.onresult = function(event) { if (event.results.length > 0) {} }recognition.start()

– 音声合成(SpeechSynthesis)speechSynthesis.speak(new SpeechSynthesisUtterance('Hello World'));

Page 5: GeckoのWeb Speech APIまわり

2013-09-30 5

Geckoでの音声認識

● APIまわり:about:configで有効化可能– dom/webidl/SpeechRecognition.webidl など– content/media/webspeech/recognition/

● バックエンド:テスト用のFakeサービスのみ● 設定:media.webspeech.recognition.enable

Page 6: GeckoのWeb Speech APIまわり

2013-09-30 6

Geckoでの音声合成

● APIまわり:about:configで有効化可能– dom/webidl/SpeechSynthesis.webidl など– content/media/webspeech/synth/

● バックエンド:Firefox OSではPicoTTSを利用– content/media/webspeech/synth/pico/

● 設定:media.webspeech.synth.enabled

Page 7: GeckoのWeb Speech APIまわり

2013-09-30 7

Geckoのイディオムabout:configによる有効化・無効化

● about:configの設定によってJavaScriptの可視・不可視が変わるオブジェクト

● WebIDL[PrefControlled]interface SpeechSynthesis { …}

Page 8: GeckoのWeb Speech APIまわり

2013-09-30 8

Geckoのイディオムabout:configによる有効化・無効化

● C++– WebIDLからConstructorEnabledが自動生成される

● SpeechSynth::PrefEnabled()を呼ぶ– PrefEnabled: (手書き)

if (!gPrefInitialized) { Preferences::AddBoolVarCache(&gWebSpeechEnabled, "media.webspeech.synth.enabled"); gPrefInitialized = true;}return gWebSpeechEnabled;

Page 9: GeckoのWeb Speech APIまわり

2013-09-30 9

まとめ

● GeckoはWeb Speech APIを実装中– 音声認識API– 音声合成API

● Geckoでのイディオム– about:configによる有効化・無効化