Skip to content

🎥 Make videos programmatically with React

Catch InputDisposedError in seekToDoNotCallDirectly

Jonny Burgerfc6a6c26c7f1
diff --git a/packages/media/src/media-player.ts b/packages/media/src/media-player.ts
index 2ea2193882..27ced4ffda 100644
--- a/packages/media/src/media-player.ts
+++ b/packages/media/src/media-player.ts
@@ -385,21 +385,29 @@ export class MediaPlayer {
this.sharedAudioContext &&
this.getAudioPlaybackTime() !== newTime;
- await Promise.all([
- this.videoIteratorManager?.seek({
- newTime,
- nonce,
- }),
- shouldSeekAudio
- ? this.audioIteratorManager?.seek({
- newTime,
- nonce,
- playbackRate: this.playbackRate * this.globalPlaybackRate,
- getIsPlaying: () => this.playing,
- scheduleAudioNode: this.scheduleAudioNode,
- })
- : null,
- ]);
+ try {
+ await Promise.all([
+ this.videoIteratorManager?.seek({
+ newTime,
+ nonce,
+ }),
+ shouldSeekAudio
+ ? this.audioIteratorManager?.seek({
+ newTime,
+ nonce,
+ playbackRate: this.playbackRate * this.globalPlaybackRate,
+ getIsPlaying: () => this.playing,
+ scheduleAudioNode: this.scheduleAudioNode,
+ })
+ : null,
+ ]);
+ } catch (error) {
+ if (this.isDisposalError()) {
+ return;
+ }
+
+ throw error;
+ }
}
public async playAudio(time: number): Promise<void> {