DefinitelyTyped/types/hark/hark-tests.ts
baiyufei d544b41b87 Create a type definition for npm module hark (#38375)
* Create a type definition for npm module hark

* Update index.d.ts

* Update index.d.ts
2019-09-25 16:12:57 -07:00

23 lines
555 B
TypeScript

import hark = require('hark');
navigator.mediaDevices.getUserMedia({ audio: true, video: true }).then(
(stream) => {
const option: hark.Option = {
smoothing: 0.1,
interval: 50,
history: 10,
threshold: -50
};
const h: hark.Harker = hark(stream, option);
h.stop();
h.resume();
h.on('speaking', () => {
console.log('speaking');
});
h.on('stopped_speaking', () => {
console.log('stop speaking');
});
}
);