Skip to content

Commit

Permalink
fix: add check for setPositionState to avoid TypeError
Browse files Browse the repository at this point in the history
  • Loading branch information
qtchaos committed Mar 15, 2024
1 parent 6f3c700 commit e0fec7f
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 e0fec7f

Please sign in to comment.