removed the weird player logo on streams

This commit is contained in:
2026-09-08 18:06:10 -07:00
parent 6d38d9c335
commit 119b0ad28f
3 changed files with 75 additions and 1 deletions

View File

@@ -323,6 +323,45 @@ async fn download_and_extract_payload(app: tauri::AppHandle, window: WebviewWind
Ok(base_dir)
}
const ANDROID_VIDEO_FIX_SCRIPT: &str = r#"
(function() {
function suppressNativeOverlay() {
const styleId = '__vyla_native_video_fix';
if (!document.getElementById(styleId)) {
const s = document.createElement('style');
s.id = styleId;
s.textContent = `
video::-webkit-media-controls,
video::-webkit-media-controls-enclosure,
video::-webkit-media-controls-panel,
video::-webkit-media-controls-overlay-play-button,
video::-webkit-media-controls-start-playback-button {
display: none !important;
-webkit-appearance: none !important;
opacity: 0 !important;
pointer-events: none !important;
}
`;
(document.head || document.documentElement).appendChild(s);
}
document.querySelectorAll('video').forEach(v => {
v.setAttribute('playsinline', '');
v.setAttribute('webkit-playsinline', '');
v.removeAttribute('poster');
});
}
suppressNativeOverlay();
new MutationObserver(suppressNativeOverlay).observe(document.documentElement, {
childList: true,
subtree: true,
attributes: true,
attributeFilter: ['poster']
});
})();
"#;
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
@@ -389,6 +428,10 @@ pub fn run() {
.setup(|app| {
let handle = app.handle().clone();
if let Some(window) = handle.get_webview_window("main") {
let _ = window.eval(ANDROID_VIDEO_FIX_SCRIPT);
}
tauri::async_runtime::spawn(async move {
std::thread::sleep(std::time::Duration::from_millis(400));
@@ -398,7 +441,10 @@ pub fn run() {
match download_and_extract_payload(handle.clone(), window.clone()).await {
Ok(_) => {
std::thread::sleep(std::time::Duration::from_millis(400));
let _ = window.eval("window.location.replace('http://vyla.localhost/frontend/index.html');");
let _ = window.eval(&format!(
"{}; window.location.replace('http://vyla.localhost/frontend/index.html');",
ANDROID_VIDEO_FIX_SCRIPT
));
}
Err(err) => {
update_ui(