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 issue arising when using track APIs at the exact last possible position of a Period with no consecutive Period #1337

Merged
merged 1 commit into from
Dec 20, 2023

Conversation

peaBerberian
Copy link
Collaborator

We found out that an issue prevented from switching the track when the current position was exactly at the position indicated by a Period's end property if there was no immediately consecutive Period.

For example if a content had, as a last Period, one starting at position 10 (seconds) and ending at 30, and if the player was currently paused at position 30 a setAudioTrack or any track switching call wouldn't have any effect.

This is because the logic handling which Period should currently be handled decides that a Period finishes as soon as we reached the position indicated by its end property. Because under that logic we're not playing the last Period anymore when we reached it, API updating tracks of the current Period do not have any effect.

It actually makes perfect sense for the frequent usecase of having consecutive Periods, where the end of one is equal to the start of the following one (in which case the following one has priority, so finishing the previous Period is wanted here), but it begins to show weird behaviors like the one described here when a Period's end is not shared with a consecutive Period, in which case we could (and probably should) consider that end position as part of that Period instead as there's no such ambiguity.

So this PR actually explicitely handles that case, which fixes the issue.

@peaBerberian peaBerberian added bug This is an RxPlayer issue (unexpected result when comparing to the API) Priority: 1 (High) This issue or PR has a high priority. labels Dec 20, 2023
@peaBerberian peaBerberian added this to the 3.33.0 milestone Dec 20, 2023
@peaBerberian peaBerberian changed the title Fix issue arising when a track at the exact last possible position of a Period with no consecutive Period Fix issue arising when using track APIs at the exact last possible position of a Period with no consecutive Period Dec 20, 2023
@peaBerberian peaBerberian force-pushed the fix/track-switch-period-end branch 3 times, most recently from e133d02 to 1b211db Compare December 20, 2023 16:11
… a Period with no consecutive Period

We found out that an issue prevented from switching the track when the
current position was exactly at the position indicated by a Period's
`end` property if there was no immediately consecutive Period.

For example if a content had, as a last Period, one starting at position
`10` (seconds) and ending at `30`, and if the player was currently
paused at position `30` a `setAudioTrack` or any track switching call
wouldn't have any effect.

This is because the logic handling which Period should currently be
handled decides that a Period finishes as soon as we reached the
position indicated by its `end` property. Because under that logic
we're not playing the last Period anymore when we reached it, API
updating tracks of the current Period do not have any effect.

It actually makes perfect sense for the frequent usecase of having
consecutive Periods, where the `end` of one is equal to the `start` of
the following one (in which case the following one has priority, so
finishing the previous Period is wanted here), but it begins to show
weird behaviors like the one described here when a Period's `end` is not
shared with a consecutive Period, in which case we could (and probably
should) consider that `end` position as part of that Period instead as
there's no such ambiguity.

So this commit actually explicitely handle that case, which fixes the
issue.
@peaBerberian peaBerberian merged commit f071352 into master Dec 20, 2023
3 checks passed
@peaBerberian peaBerberian mentioned this pull request Jan 24, 2024
@peaBerberian peaBerberian deleted the fix/track-switch-period-end branch February 7, 2024 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This is an RxPlayer issue (unexpected result when comparing to the API) Priority: 1 (High) This issue or PR has a high priority.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants