2018-03-02 pixiv社内勉強会LT
@hakatashi
Speech Recognition API
しゃべる
字幕テキスト
Speech Synthesis API
読み上げる
const recognition = new SpeechRecognition();
recognition.start();
recognition.addEventListener('result', (event) => {
console.log(event.results);
});
const utterance = new SpeechSynthesisUtterance('ほげ');
speechSynthesis.speak(utterance);
window.addEventListener('devicelight', (event) => {
console.log(`${event.value}lux`);
});
window.addEventListener("deviceorientation", (event) => {
const x = event.beta;
const y = event.gamma;
});
const range = document.caretPositionFromPoint(x, y);
const node = range.offsetNode;
const offset = range.offset;
const channel = new BroadcastChannel('channel');
channel.postMessage({title: 'hoge'});
channel.onmessage = (event) => {
console.log(event.data.title);
};