Skip to content

Conversation

@mseh1128
Copy link
Contributor

Implementation for #735

Took forever, but was able to get multiple playback modes working at the same time. In particular, handling the interactions for "Repeat+Autopause" and "Autopause+Condensed" was tricky and required some significant (and hopefully not too hacky) changes to Player.tsx/binding.ts.

@killergerbah
Copy link
Owner

Hey thanks for doing this. I've been pretty busy but will try to read this on the weekend.

@mseh1128
Copy link
Contributor Author

Btw I was testing this some more today, and realized I forgot about Auto Pause at start of subtitles. I'm working on making this work w/ Repeat mode.

@killergerbah
Copy link
Owner

@mseh1128 On the first pass my only comment is that there seems to be a lot of duplicated code related to modifying the play mode set. Maybe this should be its own collection class? "Resolve conflicts" is the only part that is different depending on the context, but it should still be possible to extract that out from all the duplicated lines.

@mseh1128
Copy link
Contributor Author

Thanks for the review. I refactored most of the playMode related code into play-mode-manager.ts. Also, I was able to get "auto pause at start" working with Repeat and Condensed modes surprisingly easily.

Copy link
Owner

@killergerbah killergerbah left a comment

Choose a reason for hiding this comment

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

Hey thanks for doing that refactor. Did a second pass.

@mseh1128
Copy link
Contributor Author

Sorry for the delay. I fixed the issues from the previous code review. Thanks 🙂.

}
},
[playMode, clock, mediaAdapter, videoFileUrl, settings.autoPausePreference, seek]
[playModes, clock, mediaAdapter, videoFileUrl, settings.autoPausePreference, seek, subtitleCollection, resetPendingAutoRepeatTargetTimestamp]
Copy link
Owner

Choose a reason for hiding this comment

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

Might be due to the merge but this line breaks for me because it's above where subtitleCollection is being initialized

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, nice catch. subtitleCollection was initialized further down in the merge. I moved it back up so should work now.

private _seekDuration = 3;
private _speedChangeStep = 0.1;
private _pendingAutoRepeatTargetTimestamp = 0;
private _lastKnownTime = 0;
Copy link
Owner

Choose a reason for hiding this comment

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

The value of this field doesn't seem to be used anywhere. Did you mean to store only _pendingAutoRepeatTargetTimestamp instead? I think _pendingAutoRepeatTargetTimestamp is not properly being reset sometimes. For example, it's pretty easy to trigger a bug where auto-repeat is enabled, but seeking to the next subtitle still retains the repeat timestamp for the previous one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like I removed the resetting of the timestamp in seekedListener() by accident. I added it back and tested so should work now.

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