Skip to content

Commit

Permalink
Merge pull request #1017 from qtchaos/fix/setPositionState
Browse files Browse the repository at this point in the history
Add check for setPositionState to avoid TypeError
  • Loading branch information
binaryoverload authored Mar 16, 2024
2 parents f1a8ff4 + e0fec7f commit 227defd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/components/player/internals/MediaSession.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ export function MediaSession() {

const updatePositionState = useCallback(
(position: number) => {
// If the browser doesn't support setPositionState, return
if (typeof navigator.mediaSession.setPositionState !== "function") return;

// If the updated position needs to be buffered, queue an update
if (position > data.progress.buffered) {
shouldUpdatePositionState.current = true;
Expand Down

0 comments on commit 227defd

Please sign in to comment.