fix(audio-only-mode): handle AbortError on no-refresh video switch; add auto-enable on blur#3
Merged
GrassBlock1 merged 4 commits intomasterfrom Mar 18, 2026
Conversation
…enable on blur Co-authored-by: GrassBlock1 <46253950+GrassBlock1@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix auto-enable switch to audio-only mode issue
fix(audio-only-mode): handle AbortError on no-refresh video switch; add auto-enable on blur
Mar 18, 2026
GrassBlock1
approved these changes
Mar 18, 2026
GrassBlock1
approved these changes
Mar 18, 2026
GrassBlock1
approved these changes
Mar 18, 2026
There was a problem hiding this comment.
Pull request overview
This PR improves the audio-only-mode video component by making auto-enable more reliable across no-refresh video navigations and by adding an optional “auto-enable on tab blur” behavior.
Changes:
- Add new
autoEnableOnBluroption (defaultfalse) to enable audio mode after the page has been hidden for 30s. - Delay auto-enable on
videoChangeto reducevideo.play()abort failures on no-refresh navigation. - Treat
AbortErrorfromvideo.play()as non-fatal and avoid showing an error toast for it.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| registry/lib/components/video/audio-only-mode/index.ts | Adds autoEnableOnBlur option metadata. |
| registry/lib/components/video/audio-only-mode/AudioOnlyMode.vue | Adds blur/visibility timer logic; delays auto-enable on videoChange; handles AbortError from play(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… initial mount Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
Two issues in the
audio-only-modecomponent:autoEnableon, switching videos without a page refresh caused anAbortError("The fetching process for the media resource was aborted by the user agent at the user's request") fromvideo.play(), silently failing the audio-mode switch.Changes
Fix:
AbortErroron no-refresh navigationvideoChangecallback now waits 800 ms before callingswitchToAudioMode(), letting the Bilibili player finish re-initialising the<video>element before we overwrite itssrc.video.play()rejection handler now distinguishesAbortErrorfrom real errors — treats it as non-fatal (warns to console, returns cleanly) rather than surfacing an error toast. The nextvideoChangewill retry.Feature: auto-enable after 30 s of page blur
autoEnableOnBlur(defaultfalse, display name失去焦点后自动启用) inindex.ts.document.visibilitychange: starts a 30 s timer on hide, cancels on show. CallsswitchToAudioMode()if still hidden and not already in audio mode.beforeDestroy.🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.