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 an exception when receiving a SourceLoaded event during scrubbing. #585

Conversation

stonko1994
Copy link
Collaborator

Problem

When the playbackPositionHandler inside the Seekbar is called without an event (i.e., with null), such as during the reception of a SourceLoaded event, the application crashes. This leads to an undefined UI state where the seekbar is partially updated to the player state, and the play button may be missing.

Changes

Adding the missing null check for the optional event parameter.

@@ -254,7 +254,7 @@ export class SeekBar extends Component<SeekBarConfig> {
// At the same time when the user is scrubbing, we also move the position of the seekbar to display a preview during scrubbing.
// When the user is scrubbing we do not record this as a user seek operation, as the user has yet to finish their seek,
// but we should not move the playback position to not create a jumping behaviour.
if (scrubbing && event.type === player.exports.PlayerEvent.SegmentRequestFinished && playbackPositionPercentage !== this.playbackPositionPercentage) {
if (scrubbing && event && event.type === player.exports.PlayerEvent.SegmentRequestFinished && playbackPositionPercentage !== this.playbackPositionPercentage) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The event is optional and even null per default. However, it's not checked if it's null (This is the only usage of this property here)

CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Giuseppe Samela <[email protected]>
@stonko1994 stonko1994 merged commit 8eaebcc into develop Nov 13, 2023
1 check passed
@stonko1994 stonko1994 deleted the feature/fix-exception-when-loading-a-new-source-while-scrubbing branch November 13, 2023 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants