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): set the GStreamer env in the AppRun hook, before exec

Yahya Zekryf4c2f0df37b1
diff --git a/scripts/linux/linuxdeploy-plugin-gtk.sh b/scripts/linux/linuxdeploy-plugin-gtk.sh
index 4a3f6fe2..4050f262 100755
--- a/scripts/linux/linuxdeploy-plugin-gtk.sh
+++ b/scripts/linux/linuxdeploy-plugin-gtk.sh
@@ -227,6 +227,22 @@ export GTK_DATA_PREFIX="$APPDIR"
export GTK_THEME="$APPIMAGE_GTK_THEME" # Custom themes are broken
export GDK_BACKEND=x11 # Crash with Wayland backend on Wayland - We tested it without it and ended up with this: https://github.com/tauri-apps/tauri/issues/8541
export XDG_DATA_DIRS="$APPDIR/usr/share:/usr/share:$XDG_DATA_DIRS" # g_get_system_data_dirs() from GLib
+
+# WebKitGTK plays media through GStreamer, and the bundled core libraries come
+# without plugins or the plugin-scanner helper — so the default scan finds no
+# appsink/autoaudiosink/decodebin and the first media pipeline dies (blank page
+# / eternal spinner). This MUST be set before exec: the app setting it at
+# runtime races WebKit's early GStreamer init through GLib's cached getenv and
+# loses nondeterministically. The user's own GST_PLUGIN_PATH always wins.
+if [ -z "${GST_PLUGIN_PATH:-}" ]; then
+ export GST_PLUGIN_PATH="$APPDIR/usr/lib/gstreamer-1.0:/usr/lib/gstreamer-1.0:/usr/lib64/gstreamer-1.0"
+fi
+if [ -z "${GST_PLUGIN_SCANNER:-}" ] && [ -x /usr/lib/gstreamer-1.0/gst-plugin-scanner ]; then
+ export GST_PLUGIN_SCANNER=/usr/lib/gstreamer-1.0/gst-plugin-scanner
+fi
+if [ -z "${GST_PLUGIN_SCANNER:-}" ] && [ -x /usr/lib64/gstreamer-1.0/gst-plugin-scanner ]; then
+ export GST_PLUGIN_SCANNER=/usr/lib64/gstreamer-1.0/gst-plugin-scanner
+fi
EOF
echo "Installing GLib schemas"
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 7fbe0402..1687d2c7 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -88,6 +88,11 @@ fn setup_environment() {
// 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.
+ //
+ // This is only a FALLBACK: the authoritative fix lives in the AppRun hook
+ // (scripts/linux/linuxdeploy-plugin-gtk.sh), which sets the variable
+ // before exec. Setting it this late races WebKit's early GStreamer init
+ // through GLib's cached getenv and loses nondeterministically.
#[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();