28 lines
684 B
TypeScript
28 lines
684 B
TypeScript
export default class Text_to_Speech {
|
|
//#region 外調參數
|
|
|
|
private _responsiveVoice: any = window["responsiveVoice"];
|
|
|
|
//#endregion
|
|
|
|
//#region Custom
|
|
|
|
constructor() {
|
|
this._responsiveVoice.speak("hello world");
|
|
}
|
|
|
|
public speak(msg: string): void {
|
|
let self: this = this;
|
|
this._responsiveVoice.speak(msg, "Chinese Female", {
|
|
onstart: function (Callback: any): void {
|
|
console.log(`onstart msg: ${msg}`);
|
|
},
|
|
onend: function (Callback: any): void {
|
|
console.log(`onstart msg: ${msg}`);
|
|
},
|
|
});
|
|
}
|
|
|
|
//#endregion
|
|
}
|