diff --git a/projects/9b6e62e6-fd85-4580-a304-bbb9761075c7/MSE 播放器:拖动时的 waiting 不能当作播完.md b/projects/9b6e62e6-fd85-4580-a304-bbb9761075c7/MSE 播放器:拖动时的 waiting 不能当作播完.md new file mode 100644 index 0000000..cbd980b --- /dev/null +++ b/projects/9b6e62e6-fd85-4580-a304-bbb9761075c7/MSE 播放器:拖动时的 waiting 不能当作播完.md @@ -0,0 +1,22 @@ +--- +title: MSE 播放器:拖动时的 waiting 不能当作播完 +type: experience +permalink: main/projects/9b6e62e6-fd85-4580-a304-bbb9761075c7/mse-播放器拖动时的-waiting-不能当作播完 +stable_id: cc4f7ee7-b994-4304-b6c3-ef95ad5d7372 +scope: project +memory_type: experience +project_id: 9b6e62e6-fd85-4580-a304-bbb9761075c7 +usage_profile_id: 0c9feb46-d06e-43cd-9ef0-c5813c84a998 +status: active +revision: 1 +request_id: v380-mse-waiting-experience-2026-11-13-0217 +created_at: '2026-11-12T18:14:53.281307+00:00' +updated_at: '2026-11-12T18:14:53.281307+00:00' +tags: +- v380 +- frontend +- mse +--- + +问题:缓存好的录像在已缓冲范围内拖动时,浏览器会短暂触发 waiting。早期实现在 waiting 里发现“后面没有数据”就当作播完,导致一拖动就跳到下一段。 +解决:onWaiting 先判断正在加载或当前时间已缓冲就直接返回;否则跳到下一个已缓冲区间;只有 MediaSource 已 ended 且当前时间贴近 duration 时才当作播完。正常播完靠 video 的 ended 事件。另外 canplay/playing 时清空状态文字,避免暂停时拖动留下“正在缓冲”。 \ No newline at end of file