feat: play through GStreamer instead of mpv
A Flatpak cannot run the host's mpv, and SteamOS does not ship one. GStreamer comes with the Flatpak runtime, so the player now drives playbin in-process. The next track is handed over in about-to-finish, which keeps playback gapless as it was with mpv. GStreamer's HTTP errors quote the stream URL, so its query string, which carries the auth token, is stripped before logging.
This commit is contained in:
+3
-7
@@ -56,7 +56,7 @@ pub fn install(ui: &AppWindow, rt: Handle) {
|
||||
with_app(|app| app.start());
|
||||
}
|
||||
|
||||
/// Drops the app, which stops mpv.
|
||||
/// Drops the app, which stops playback.
|
||||
pub fn shutdown() {
|
||||
let app = APP.with(|cell| cell.borrow_mut().take());
|
||||
drop(app);
|
||||
@@ -1290,7 +1290,7 @@ impl App {
|
||||
fn play_songs(&mut self, songs: Vec<Song>, start: usize) {
|
||||
let Some(client) = &self.client else { return };
|
||||
let Some(player) = &self.player else {
|
||||
self.toast("Playback is unavailable: mpv is not running".into());
|
||||
self.toast("Playback is unavailable: GStreamer could not start".into());
|
||||
return;
|
||||
};
|
||||
let urls: Vec<String> = songs.iter().map(|s| client.stream_url(&s.id)).collect();
|
||||
@@ -1304,7 +1304,7 @@ impl App {
|
||||
fn enqueue(&mut self, songs: Vec<Song>, what: String) {
|
||||
let Some(client) = &self.client else { return };
|
||||
let Some(player) = &self.player else {
|
||||
self.toast("Playback is unavailable: mpv is not running".into());
|
||||
self.toast("Playback is unavailable: GStreamer could not start".into());
|
||||
return;
|
||||
};
|
||||
if songs.is_empty() {
|
||||
@@ -1396,10 +1396,6 @@ impl App {
|
||||
self.sync_items(true);
|
||||
self.sync_queue(true);
|
||||
}
|
||||
PlayerEvent::Exited => {
|
||||
self.player = None;
|
||||
self.toast("Playback stopped: mpv exited".into());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user