mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-20 14:37:43 +01:00
Merge pull request #1017 from qtchaos/fix/setPositionState
Add check for setPositionState to avoid TypeError
This commit is contained in:
commit
227defd713
1 changed files with 3 additions and 0 deletions
|
@ -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…
Reference in a new issue