fix end of stream lol

This commit is contained in:
Erica Z 2024-10-20 13:26:36 +02:00
parent af127b8d7b
commit 5c24cde637

View file

@ -148,6 +148,11 @@ public class Playbin : GLib.Object {
} else { } else {
this.inc_position = true; this.inc_position = true;
} }
// estimate duration from api data
// while mpv doesn't know it
this.duration = ((Subsonic.Song) this._play_queue.get_item (this.play_queue_position)).duration;
this.new_track (); this.new_track ();
break; break;
@ -158,10 +163,9 @@ public class Playbin : GLib.Object {
warning ("playback of track aborted: %s", data.error.to_string ()); warning ("playback of track aborted: %s", data.error.to_string ());
} }
if (this.inc_position) { if (this.inc_position && this.play_queue_position+1 == this._play_queue.get_n_items ()) {
// reached the end // reached the end (?)
this.play_queue_position += 1; this.play_queue_position += 1;
assert (this.play_queue_position == this._play_queue.get_n_items ());
this.state = PlaybinState.STOPPED; this.state = PlaybinState.STOPPED;
this.stopped (); this.stopped ();
} }