Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: seeking when preload is none #997

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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