Skip to content

Commit

Permalink
Dirty hack to enable mediaSession integration when playing with Aurora
Browse files Browse the repository at this point in the history
In all browsers today, the mediaSession API has been limited to work
only when there is an Audio element (with a valid src) in the scope.
Because of this, the media controls were not available while playing
with the Aurora.js backend.

This is now worked around by initializing a dummy Audio element when
playback with Aurora.js starts. On Firefox, there was such an extra
requirement that the Audio element must not be completely silent (i.e.
just silent audio src didn't work, nor setting the volume to exactly
0). Hence, our dummy audio content actually has some sound but it's
played in extremely quiet volume, making it impossible to hear.

The proper solution for the issue would be for the browsers to
implement the audio focus API (see
w3c/mediasession#277). This has been first
suggested years ago but so far there's no known progress.
  • Loading branch information
paulijar committed Dec 31, 2022
1 parent a813162 commit 88d7a43
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 4 deletions.
Loading

0 comments on commit 88d7a43

Please sign in to comment.