diff --git a/src/views/open_live/ReadDanmaku.vue b/src/views/open_live/ReadDanmaku.vue
index fb84306..537c948 100644
--- a/src/views/open_live/ReadDanmaku.vue
+++ b/src/views/open_live/ReadDanmaku.vue
@@ -132,7 +132,7 @@ async function speak() {
speechCount.value--
readedDanmaku.value++
console.log(`[TTS] 正在朗读: ${text}`)
- await EasySpeech.speak({
+ /*await EasySpeech.speak({
text: text,
volume: settings.value.speechInfo.volume,
pitch: settings.value.speechInfo.pitch,
@@ -150,7 +150,29 @@ async function speak() {
})
.finally(() => {
isSpeaking.value = false
- })
+ })*/
+ const synth = window.speechSynthesis
+ let u = new SpeechSynthesisUtterance()
+ u.text = text
+ let voices = synth.getVoices()
+ const voice = voices.find((v) => v.name === settings.value.speechInfo.voice)
+ if (voice) {
+ u.voice = voice
+ u.volume = settings.value.speechInfo.volume
+ u.rate = settings.value.speechInfo.rate
+ u.pitch = settings.value.speechInfo.pitch
+ synth.speak(u)
+ u.onend = () => {
+ isSpeaking.value = false
+ }
+ u.onerror = (err) => {
+ if (err.error == 'interrupted') {
+ return
+ }
+ console.log(err)
+ message.error('无法播放语音: ' + err.error)
+ }
+ }
}
}
function onGetEvent(data: EventModel) {
@@ -219,6 +241,7 @@ function stopSpeech() {
}
function cancelSpeech() {
EasySpeech.cancel()
+ isSpeaking.value = false
}
async function uploadConfig() {
await QueryPostAPI(VTSURU_API_URL + 'set-config', {
@@ -351,77 +374,92 @@ onUnmounted(() => {
你的浏览器不支持语音功能
-
- {{ canSpeech ? '停止监听' : '开始监听' }}
- 保存配置到服务器
-
-
- 从服务器获取配置
-
- 这将覆盖当前设置, 确定?
-
-
-
- 状态
-
+
+
+ 建议在 Edge 浏览器使用
-
-
-
-
-
+ Microsoft 某某 Online (Nature)
- {{ isSpeaking ? '取消朗读' : '未朗读' }}
+ 例如 Microsoft Xiaoxiao Online (Natural) - Chinese (Mainland), 各种营销号就用的这些配音
- 队列: {{ speechCount }} 已读: {{ readedDanmaku }} 条
-
-
-
-
-
-
- 音量
-
-
-
- 音调
-
-
-
- 语速
-
-
-
- 自定义内容
-
+ 系列语音, 效果要好很多
+
+
- 支持的变量:
- {{ item.words }} | {{ item.name }}
+
+ {{ canSpeech ? '停止监听' : '开始监听' }}
+
+ 保存配置到服务器
+
+
+ 从服务器获取配置
+
+ 这将覆盖当前设置, 确定?
+
-
- 弹幕模板
-
- 测试
-
-
- 礼物模板
-
- 测试
-
-
- SC模板
-
- 测试
-
-
- 上舰模板
-
- 测试
-
-
- 设置
- 没想好需要什么, 有建议的话可以和我说
+
+ 状态
+
+
+
+
+
+
+
+
+
+ {{ isSpeaking ? '取消朗读' : '未朗读' }}
+
+ 队列: {{ speechCount }} 已读: {{ readedDanmaku }} 条
+
+
+
+
+
+
+ 音量
+
+
+
+ 音调
+
+
+
+ 语速
+
+
+
+ 自定义内容
+
+
+ 支持的变量:
+ {{ item.words }} | {{ item.name }}
+
+
+ 弹幕模板
+
+ 测试
+
+
+ 礼物模板
+
+ 测试
+
+
+ SC模板
+
+ 测试
+
+
+ 上舰模板
+
+ 测试
+
+
+ 设置
+ 没想好需要什么, 有建议的话可以和我说
+