Skip to content

Commit

Permalink
Fix OSD event after player reset
Browse files Browse the repository at this point in the history
  • Loading branch information
viown committed Oct 15, 2024
1 parent b627667 commit bf3ec6a
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions src/components/playback/skipsegment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,6 @@ class SkipSegment extends PlaybackSubscriber {
super(playbackManager);

this.onOsdChanged = this.onOsdChanged.bind(this);

Events.on(document, EventType.SHOW_VIDEO_OSD, this.onOsdChanged);
}

onOsdChanged(_e: Event, isOpen: boolean) {
if (this.currentSegment) {
if (isOpen) {
this.showSkipButton({
animate: false,
keep: true
});
} else if (!this.hideTimeout) {
this.hideSkipButton();
}
}
}

onHideComplete() {
Expand Down Expand Up @@ -129,6 +114,19 @@ class SkipSegment extends PlaybackSubscriber {
}
}

onOsdChanged(_e: Event, isOpen: boolean) {
if (this.currentSegment) {
if (isOpen) {
this.showSkipButton({
animate: false,
keep: true
});
} else if (!this.hideTimeout) {
this.hideSkipButton();
}
}
}

onPromptSkip(segment: MediaSegmentDto) {
if (!this.currentSegment) {
this.currentSegment = segment;
Expand All @@ -152,6 +150,13 @@ class SkipSegment extends PlaybackSubscriber {
}
}

onPlayerChange(): void {
if (this.playbackManager.getCurrentPlayer()) {
Events.off(document, EventType.SHOW_VIDEO_OSD, this.onOsdChanged);
Events.on(document, EventType.SHOW_VIDEO_OSD, this.onOsdChanged);
}
}

onPlaybackStop() {
this.currentSegment = null;
this.hideSkipButton();
Expand Down

0 comments on commit bf3ec6a

Please sign in to comment.