Skip to content

Update offscreen.js#2

Open
imrayya wants to merge 1 commit intophildougherty:mainfrom
imrayya:main
Open

Update offscreen.js#2
imrayya wants to merge 1 commit intophildougherty:mainfrom
imrayya:main

Conversation

@imrayya
Copy link

@imrayya imrayya commented Aug 14, 2025

I got an error in trying to do TTS multiple time in short period of time, I discovered that a single element can only be wrapped by createMediaElementSource() once per AudioContext. If you try to call it again for the same element in the same context, you’ll get the "media element source already connected" error.

Instead of re-creating the media source for each play, only create it once.

I'm not 100% confident that this is the way to go since I don't work with JS or chrome extensions but it seems to work for me on Edge.

I got an error in trying to do TTS multiple time in short period of time, I discovered that a single <audio> element can only be wrapped by createMediaElementSource() once per AudioContext.
If you try to call it again for the same element in the same context, you’ll get the "media element source already connected" error.

Instead of re-creating the media source for each play, only create it once.
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