Fix play next episode for MX and MPV external players#5379
Fix play next episode for MX and MPV external players#5379RealGreenDragon wants to merge 2 commits intojellyfin:release-0.19.zfrom
Conversation
app/src/main/java/org/jellyfin/androidtv/ui/playback/ExternalPlayerActivity.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/jellyfin/androidtv/ui/playback/ExternalPlayerActivity.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/jellyfin/androidtv/ui/playback/ExternalPlayerActivity.kt
Outdated
Show resolved
Hide resolved
c7d59c5 to
7c43104
Compare
|
@nielsvanvelzen I rewrite PR by adding a playbackCompleted flag that is true only if natively the external player communicate the playback completed at runtime end, this for all external player supported (not only MX and MPV). Following the cases when we are sure from documentation that playback is completed for each external player:
Finally, as discussed before at the server we send runtime instead of endPosition if playback is completed. |
app/src/main/java/org/jellyfin/androidtv/ui/playback/ExternalPlayerActivity.kt
Outdated
Show resolved
Hide resolved
|
|
||
| val runtime = (mediaSource.runTimeTicks ?: item.runTimeTicks)?.ticks | ||
| val shouldPlayNext = runtime != null && endPosition != null && endPosition >= (runtime * 0.9) | ||
| val shouldPlayNext = (playbackCompleted) || (runtime != null && endPosition != null && endPosition >= (runtime * 0.9)) |
Check warning
Code scanning / detekt
Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning
|
Did you even test these changes? Because the code doesn't even compile right now. |
Sorry no, but now I tested the build and with my last commit it finish without errors. The build error was caused by resultCode not present in result. I fixed editing onItemFinished sign to pass ActivityResult instead of data Intent. |
Changes
Fixes a regression where the "play next episode" feature failed for external players (specifically MX Player and MPV) because they do not return a standard playback position upon completion.
end_byflag).This restores functionality that was previously covered by the "time elapsed" fallback check, which was removed in v0.19.
Code assistance
Used LLM to verify Kotlin syntax and validate the Intent handling logic for specific players.
Issues
Fixes #5293