Skip to content

fix: Only instantiate NavigatorMediaSession in browsers with support for the Media Session API.#1268

Merged
mihar-22 merged 1 commit into
vidstack:mainfrom
soulprovidr:check-media-session
Apr 29, 2024
Merged

fix: Only instantiate NavigatorMediaSession in browsers with support for the Media Session API.#1268
mihar-22 merged 1 commit into
vidstack:mainfrom
soulprovidr:check-media-session

Conversation

@soulprovidr

@soulprovidr soulprovidr commented Apr 28, 2024

Copy link
Copy Markdown
Contributor

Description:

The Media Session API isn't supported universally, so this PR prevents uncaught exceptions by ensuring that the NavigatorMediaSession class (which has a dependency on the Media Session API) is not instantiated in browsers without support.

The check is copied from the example on the MediaMetadata MDN page.

Ready?

Yes

Anything Else?

caniuse.com: MediaSession API (94.08% global support)

@mihar-22 mihar-22 merged commit e6a3fb4 into vidstack:main Apr 29, 2024
@soulprovidr soulprovidr changed the title fix: Only instantiate NavigatorMediaSession in browsers with support for MediaMetadata. fix: Only instantiate NavigatorMediaSession in browsers with support for the Media Session API. Apr 29, 2024
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.

2 participants