mirror of
https://github.com/movie-web/movie-web.git
synced 2025-01-14 08:45:13 +00:00
fix: add check for setPositionState to avoid TypeError
This commit is contained in:
parent
6f3c700dcb
commit
e0fec7ffa3
|
@ -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