Repository navigation
fix: end quietly when Plex closes the player and ride out MSE quota - #9
Merged
Merged
Conversation
Closing the player in Plex Web clears the video src before any takeover-stop arrives, so the next SourceBuffer call threw an unmapped InvalidStateError and users saw "playback_failed" right after they stopped. A detached media element now ends the session as a normal stop and tells the hook to release the takeover. Chrome limits each SourceBuffer track separately (12 MB audio by default), so high-bitrate audio could exhaust the quota inside the 90 s window and end playback with buffer_quota. A quota hit now narrows the forward window and retries once playback frees space, failing only when the buffer cannot hold a few seconds ahead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
用户影响
buffer_quota。原因
src,Hook 只拦截 Shakaload,扩展收不到takeover-stop。MSE 控制器下一次操作 SourceBuffer 抛出未映射的InvalidStateError,Host 按播放失败处理并提示中断。改动
mse-controller在失败时检查媒体元素是否仍指向本会话的 MediaSource,被外部接走则改抛MseMediaDetachedError,并且无论src是否已被替换都释放 object URL。plex-native-host把MseMediaDetachedError当作正常结束,记为detached,不提示失败或中断,并发takeover-error: media_detached让 Hook 释放会话。不发这条消息时,同一媒体再次load会复用已结束的接管,播放器一直转圈。MseBufferQuotaExceededError。MseMediaDetachedError归为cancelled,不记作网络失败。验证
src后归为外部卸载并只释放一次 object URL、Host 对外部卸载静默收尾并通知 Hook。detached,页面没有中断提示;随后再次点播放,扩展重新接管且进度正常推进。🤖 Generated with Claude Code