Skip to content

Commit

Permalink
fix: seeking when preload is none
Browse files Browse the repository at this point in the history
  • Loading branch information
luwes committed Oct 4, 2024
1 parent e913e7d commit 9794ad1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/vanilla/mobile.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<body>
<main>
<h1>Media Chrome Standard Mobile Video Usage Example</h1>
<media-controller autohide="2">
<media-controller autohide="2" defaultduration="134">
<video
slot="media"
src="https://stream.mux.com/DS00Spx1CV902MCtPj5WknGlR102V5HFkDe/high.mp4"
Expand Down
4 changes: 2 additions & 2 deletions src/js/media-store/state-mediator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
toggleSubtitleTracks,
} from './util.js';
import { getTextTracksList } from '../utils/captions.js';
import { isValidNumber } from '../utils/utils.js';

export type Rendition = {
src?: string;
Expand Down Expand Up @@ -432,8 +433,7 @@ export const stateMediator: StateMediator = {
},
set(value, stateOwners) {
const { media } = stateOwners;
// If the media supports readyState and it's not ready, don't set currentTime
if (!media || media.readyState === 0) return;
if (!media || !isValidNumber(value)) return;
media.currentTime = value;
},
mediaEvents: ['timeupdate', 'loadedmetadata'],
Expand Down

0 comments on commit 9794ad1

Please sign in to comment.