Skip to content

Fix interrupted video play during screen capture#7

Open
HocKaTop wants to merge 1 commit into
WentTheFox:mainfrom
HocKaTop:main
Open

Fix interrupted video play during screen capture#7
HocKaTop wants to merge 1 commit into
WentTheFox:mainfrom
HocKaTop:main

Conversation

@HocKaTop

Copy link
Copy Markdown

This fixes a screen capture startup issue where video.play() can be interrupted before the media element is ready.

The previous flow assigned srcObject and immediately called play(). In some browsers this can reject with:

The play() request was interrupted because the media was removed from the document

Changes:

  • wait for loadedmetadata before calling video.play()
  • prevent duplicate capture startup with a starting guard
  • clean up the stream if startup fails
  • pause and detach the video source during stop

Tested locally with:

npm install
npm run dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant