fix(mpv): loading item immediately restarts the playback causing duplicate external subtitle entries
This commit is contained in:
parent
c7849a70c3
commit
07c58accf0
1 changed files with 5 additions and 2 deletions
|
@ -869,8 +869,11 @@ class MPVPlayer(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
currentIndex = index
|
currentIndex = index
|
||||||
|
// Only set the playlist index when the index is not the currently playing item. Otherwise playback will be restarted.
|
||||||
|
// This is a problem on initial load when the first item is still loading causing duplicate external subtitle entries.
|
||||||
|
if (MPVLib.getPropertyInt("playlist-current-pos") != index) {
|
||||||
MPVLib.command(arrayOf("playlist-play-index", "$index"))
|
MPVLib.command(arrayOf("playlist-play-index", "$index"))
|
||||||
MPVLib.setPropertyBoolean("pause", true)
|
}
|
||||||
listeners.sendEvent(Player.EVENT_TIMELINE_CHANGED) { listener ->
|
listeners.sendEvent(Player.EVENT_TIMELINE_CHANGED) { listener ->
|
||||||
listener.onTimelineChanged(timeline, Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED)
|
listener.onTimelineChanged(timeline, Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue