Merge pull request #59 from Juice10/goto-play
Allow goto to specify if it should play or pause
This commit is contained in:
@@ -141,13 +141,14 @@
|
|||||||
replayer.pause();
|
replayer.pause();
|
||||||
};
|
};
|
||||||
|
|
||||||
export const goto = (timeOffset: number) => {
|
export const goto = (timeOffset: number, play?: boolean) => {
|
||||||
currentTime = timeOffset;
|
currentTime = timeOffset;
|
||||||
const isPlaying = playerState === 'playing';
|
const resumePlaying =
|
||||||
replayer.pause();
|
typeof play === 'boolean' ? play : playerState === 'playing';
|
||||||
replayer.play(timeOffset);
|
if (resumePlaying) {
|
||||||
if (!isPlaying) {
|
replayer.play(timeOffset);
|
||||||
replayer.pause();
|
} else {
|
||||||
|
replayer.pause(timeOffset);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -110,8 +110,8 @@
|
|||||||
export const pause = () => {
|
export const pause = () => {
|
||||||
controller.pause();
|
controller.pause();
|
||||||
};
|
};
|
||||||
export const goto = (timeOffset: number) => {
|
export const goto = (timeOffset: number, play?: boolean) => {
|
||||||
controller.goto(timeOffset);
|
controller.goto(timeOffset, play);
|
||||||
};
|
};
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
|
|||||||
2
typings/index.d.ts
vendored
2
typings/index.d.ts
vendored
@@ -32,5 +32,5 @@ export default class rrwebPlayer extends SvelteComponent {
|
|||||||
triggerResize: () => void;
|
triggerResize: () => void;
|
||||||
play: () => void;
|
play: () => void;
|
||||||
pause: () => void;
|
pause: () => void;
|
||||||
goto: (timeOffset: number) => void;
|
goto: (timeOffset: number, play?: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user