Fix marker seeking (#689)

This commit is contained in:
WithoutPants
2020-07-29 11:50:58 +10:00
committed by GitHub
parent c327a98ecb
commit 278be33618

View File

@@ -95,9 +95,6 @@ export class ScenePlayerImpl extends React.Component<
private onReady() { private onReady() {
this.player = JWUtils.getPlayer(); this.player = JWUtils.getPlayer();
if (this.props.timestamp > 0) {
this.player.seek(this.props.timestamp);
}
this.player.on("error", (err: any) => { this.player.on("error", (err: any) => {
if (err && err.code === 224003) { if (err && err.code === 224003) {
@@ -115,6 +112,12 @@ export class ScenePlayerImpl extends React.Component<
this.handleError(); this.handleError();
} }
}); });
this.player.on("playlist", () => {
if (this.props.timestamp > 0) {
this.player.seek(this.props.timestamp);
}
});
} }
private onSeeked() { private onSeeked() {
@@ -152,6 +155,12 @@ export class ScenePlayerImpl extends React.Component<
console.log("Trying next source in playlist"); console.log("Trying next source in playlist");
this.player.load(this.playlist); this.player.load(this.playlist);
this.player.play(); this.player.play();
this.player.on("firstFrame", () => {
if (this.props.timestamp > 0) {
this.player.seek(this.props.timestamp);
}
});
} }
} }
@@ -210,6 +219,7 @@ export class ScenePlayerImpl extends React.Component<
const seekHook = (seekToPosition: number, _videoTag: HTMLVideoElement) => { const seekHook = (seekToPosition: number, _videoTag: HTMLVideoElement) => {
if ( if (
!_videoTag.src ||
ScenePlayerImpl.isDirectStream(_videoTag.src) || ScenePlayerImpl.isDirectStream(_videoTag.src) ||
_videoTag.src.endsWith(".m3u8") _videoTag.src.endsWith(".m3u8")
) { ) {