diff --git a/TUICallKit-Vue3/pages/training/metronome.vue b/TUICallKit-Vue3/pages/training/metronome.vue index 2a63721c..07f10639 100644 --- a/TUICallKit-Vue3/pages/training/metronome.vue +++ b/TUICallKit-Vue3/pages/training/metronome.vue @@ -36,7 +36,6 @@ :muted="true" :loop="true" :autoplay="true" - :playback-rate="playbackRate" :show-controls="false" :show-fullscreen-btn="false" :show-play-btn="false" @@ -44,6 +43,8 @@ :enable-progress-gesture="false" :show-mute-btn="false" object-fit="contain" + @error="onVideoError" + @loadedmetadata="onVideoLoaded" /> @@ -157,6 +158,23 @@ onMounted(() => { setTimeout(() => videoCtx?.pause(), 50) }) +const onVideoError = (e: any) => { + console.error('[runner-video] error:', e?.detail || e) + uni.showToast({ + title: '视频加载失败,请用真机预览', + icon: 'none', + duration: 2500, + }) +} + +const onVideoLoaded = (e: any) => { + console.log('[runner-video] metadata loaded:', e?.detail) + /* 元数据加载完后再设 playbackRate,部分基础库初始化时设非 1.0 会卡 */ + try { + videoCtx?.playbackRate?.(playbackRate.value) + } catch (_) {} +} + /* 节拍器状态变化 → 同步视频播放/暂停 */ watch(isPlaying, (playing) => { if (playing) {