1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-29 16:07:40 +01:00

Merge pull request #1017 from qtchaos/fix/setPositionState

Add check for setPositionState to avoid TypeError
This commit is contained in:
William Oldham 2024-03-16 08:36:09 +00:00 committed by GitHub
commit 227defd713
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -32,6 +32,9 @@ export function MediaSession() {
const updatePositionState = useCallback( const updatePositionState = useCallback(
(position: number) => { (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 the updated position needs to be buffered, queue an update
if (position > data.progress.buffered) { if (position > data.progress.buffered) {
shouldUpdatePositionState.current = true; shouldUpdatePositionState.current = true;