Browse Source

fix: add check for setPositionState to avoid TypeError

pull/1017/head
qtchaos 1 year ago
parent
commit
e0fec7ffa3
No known key found for this signature in database
GPG Key ID: 7DA98B2B9EF06A90
  1. 3
      src/components/player/internals/MediaSession.tsx

3
src/components/player/internals/MediaSession.tsx

@ -32,6 +32,9 @@ export function MediaSession() { @@ -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;

Loading…
Cancel
Save