Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect progress shown if the media is playing in a background-tab #1267

Closed
jonas2515 opened this issue Dec 7, 2017 · 3 comments
Closed
Labels

Comments

@jonas2515
Copy link
Contributor

Wavesurfer.js version(s)

master-branch

Browser version(s):

Newest Firefox and Chrome

If using the media element as a backend, the waveform gets updated when a new frame is drawn.

So when the user starts playback and switches to another tab, the framerate for the current tab is reduced for energy saving reasons and the waveform gets updated at a slower interval.

And since the waveform doesn't get updated if the player isn't playing, finishing the playback while another tab is active and then switching back to the wavesurfer tab can lead to a progress bar "being stuck" somewhere in the middle of the waveform.

I didn't check if this is also the case with the WebAudio backend, as a fix for this one I propose subscribing to the pause event of the media element and updating the waveform one last time.

@jonas2515 jonas2515 changed the title Incorrect progress shown if the media is playing in a background-tab. Incorrect progress shown if the media is playing in a background-tab Dec 7, 2017
jonas2515 added a commit to jonas2515/wavesurfer.js that referenced this issue Dec 7, 2017
* The progress might not get updated if the playback finishes while another tab is active
* Fix it by updating the progress as soon as the playback is paused
@thijstriemstra
Copy link
Contributor

can you also check if it's the case for the webaudio backend?

@jonas2515
Copy link
Contributor Author

I don't think it is. In the WebAudio backend, the audioprocess event is fired by ScriptProcessorNode in the browser and just forwarded by wavesurfer.

thijstriemstra pushed a commit that referenced this issue Dec 22, 2017
…1268)

* MediaElement backend: Update progress on pause events (#1267)
* The progress might not get updated if the playback finishes while another tab is active
* Fix it by updating the progress as soon as the playback is paused
* MediaElement backend: Store volume between media changes
* When loading a new audio file, the volume is reset to 1 because a new MediaElement is created
* With the WebAudio backend the volume stays the same, this should also happen using the MediaElement backend
* Revert "set isMuted to false on load method (#1045)"
* For the WebAudio backend muting already persists
* For the MediaElement backend muting persists since 6b897c4
* add changelog entry
@thijstriemstra
Copy link
Contributor

Merged in 2.0.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants