mirror of
https://gitlab.com/vyla-entertainment/go.git
synced 2026-11-20 18:35:42 -05:00
removed the weird player logo on streams
This commit is contained in:
1
frontend
Submodule
1
frontend
Submodule
Submodule frontend added at e23979cbe0
@@ -1,9 +1,36 @@
|
|||||||
package com.vyla.go
|
package com.vyla.go
|
||||||
|
|
||||||
|
import android.graphics.Bitmap
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.webkit.WebChromeClient
|
||||||
|
import android.webkit.WebView
|
||||||
|
|
||||||
class MainActivity : TauriActivity() {
|
class MainActivity : TauriActivity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
val root = findViewById<ViewGroup>(android.R.id.content)
|
||||||
|
root.viewTreeObserver.addOnGlobalLayoutListener {
|
||||||
|
findAndHookWebView(root)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun findAndHookWebView(view: View) {
|
||||||
|
if (view is WebView) {
|
||||||
|
view.webChromeClient = object : WebChromeClient() {
|
||||||
|
override fun getDefaultVideoPoster(): Bitmap {
|
||||||
|
return Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (view is ViewGroup) {
|
||||||
|
for (i in 0 until view.childCount) {
|
||||||
|
findAndHookWebView(view.getChildAt(i))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -323,6 +323,45 @@ async fn download_and_extract_payload(app: tauri::AppHandle, window: WebviewWind
|
|||||||
Ok(base_dir)
|
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)]
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||||
pub fn run() {
|
pub fn run() {
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
@@ -389,6 +428,10 @@ pub fn run() {
|
|||||||
.setup(|app| {
|
.setup(|app| {
|
||||||
let handle = app.handle().clone();
|
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 {
|
tauri::async_runtime::spawn(async move {
|
||||||
std::thread::sleep(std::time::Duration::from_millis(400));
|
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 {
|
match download_and_extract_payload(handle.clone(), window.clone()).await {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
std::thread::sleep(std::time::Duration::from_millis(400));
|
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) => {
|
Err(err) => {
|
||||||
update_ui(
|
update_ui(
|
||||||
|
|||||||
Reference in New Issue
Block a user