Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

fix(appimage): point WebKit's GStreamer at the system plugins

Yahya Zekrycf952b862903
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 01e80857..7fbe0402 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -77,6 +77,32 @@ fn setup_environment() {
{
std::env::set_var("GDK_BACKEND", "x11");
}
+
+ // WebKit plays media through GStreamer, and the AppImage bundles
+ // GStreamer's core libraries — so the bundled libgstreamer looks for the
+ // playback elements (appsink, autoaudiosink, decodebin) inside the
+ // AppImage's own gstreamer-1.0 directory, which linuxdeploy does not fill,
+ // and never scans the system's. Anything that starts a media pipeline
+ // (the study course player) then dies on a NULL GObject and blanks the
+ // page. Point the scan at the system plugin directories; they are
+ // ABI-compatible because the bundled libraries are the same gst the
+ // system plugins were built against. GST_PLUGIN_PATH adds to the scan
+ // instead of replacing it, and an explicit user choice always wins.
+ #[cfg(target_os = "linux")]
+ if std::env::var_os("APPIMAGE").is_some() && std::env::var_os("GST_PLUGIN_PATH").is_none() {
+ let mut dirs: Vec<String> = Vec::new();
+ if let Some(appdir) = std::env::var_os("APPDIR") {
+ dirs.push(format!("{}/usr/lib/gstreamer-1.0", appdir.to_string_lossy()));
+ }
+ for dir in ["/usr/lib/gstreamer-1.0", "/usr/lib64/gstreamer-1.0"] {
+ if std::path::Path::new(dir).is_dir() {
+ dirs.push(dir.to_string());
+ }
+ }
+ if dirs.len() > 1 {
+ std::env::set_var("GST_PLUGIN_PATH", dirs.join(":"));
+ }
+ }
}
/// Usa um WebView2 Fixed Version Runtime descompactado ao lado do executavel.