feat: support Edge browser
This commit is contained in:
@@ -32,7 +32,10 @@ export const useTTS = () => {
|
||||
if (isSSML) {
|
||||
utterance = markdownToSSML(utterance)
|
||||
}
|
||||
if (import.meta.env.BROWSER === "chrome") {
|
||||
if (
|
||||
import.meta.env.BROWSER === "chrome" ||
|
||||
import.meta.env.BROWSER === "edge"
|
||||
) {
|
||||
chrome.tts.speak(utterance, {
|
||||
voiceName: voice,
|
||||
onEvent(event) {
|
||||
@@ -68,7 +71,7 @@ export const useTTS = () => {
|
||||
let currentAudioData =
|
||||
nextAudioData ||
|
||||
(await generateSpeech(apiKey, sentences[i], voiceId, modelId))
|
||||
|
||||
|
||||
if (i < sentences.length - 1) {
|
||||
generateSpeech(apiKey, sentences[i + 1], voiceId, modelId)
|
||||
.then((nextAudioData) => {
|
||||
@@ -112,7 +115,7 @@ export const useTTS = () => {
|
||||
return
|
||||
}
|
||||
|
||||
if (import.meta.env.BROWSER === "chrome") {
|
||||
if (import.meta.env.BROWSER === "chrome" || import.meta.env.BROWSER === "edge") {
|
||||
chrome.tts.stop()
|
||||
} else {
|
||||
window.speechSynthesis.cancel()
|
||||
|
||||
Reference in New Issue
Block a user