fix(player): Force native HLS on Android to resolve WebView black screen
This commit is contained in:
parent
979f9de6b2
commit
3151691fac
5 changed files with 86 additions and 2 deletions
Binary file not shown.
|
|
@ -69,13 +69,21 @@ export function initPlayer(container, options = {}) {
|
|||
theme: '#f5c518', // Golden-yellow accent
|
||||
lang: 'en',
|
||||
moreVideoAttr: {
|
||||
crossOrigin: 'anonymous',
|
||||
// crossOrigin: 'anonymous',
|
||||
preload: 'auto',
|
||||
},
|
||||
airplay: true,
|
||||
// HLS custom configuration for better buffering
|
||||
customType: {
|
||||
m3u8: function playM3u8(video, url, art) {
|
||||
// Check if Android - prefer native HLS to avoid CORS/hls.js issues
|
||||
const isAndroid = /Android/i.test(navigator.userAgent);
|
||||
|
||||
if (isAndroid && video.canPlayType('application/vnd.apple.mpegurl')) {
|
||||
video.src = url;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Hls.isSupported()) {
|
||||
if (art.hls) {
|
||||
art.hls.destroy();
|
||||
|
|
|
|||
30
build_apk.sh
Normal file
30
build_apk.sh
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
echo "🚀 Starting StreamFlix Android Build..."
|
||||
|
||||
# 1. Setup Java 17 (using the one we downloaded)
|
||||
export JAVA_HOME=/tmp/jdk-17.0.13+11/Contents/Home
|
||||
export PATH=$JAVA_HOME/bin:$PATH
|
||||
|
||||
# 2. Setup Gradle (using the one we downloaded)
|
||||
export PATH=/tmp/gradle-8.10.2/bin:$PATH
|
||||
|
||||
echo "📍 Java Home: $JAVA_HOME"
|
||||
echo "📍 Java Version: $(java -version 2>&1 | head -1)"
|
||||
echo "📍 Gradle Version: $(gradle -version | grep Gradle | head -1)"
|
||||
|
||||
# 3. Clean and Build
|
||||
cd frontend/android
|
||||
echo "🧹 Cleaning..."
|
||||
# gradle clean
|
||||
|
||||
echo "📦 Building APK..."
|
||||
gradle assembleDebug
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "✅ Build Success!"
|
||||
echo "📂 APK Location: frontend/android/app/build/outputs/apk/debug/app-debug.apk"
|
||||
open frontend/android/app/build/outputs/apk/debug/
|
||||
else
|
||||
echo "❌ Build Failed"
|
||||
exit 1
|
||||
fi
|
||||
38
deploy_apk.sh
Normal file
38
deploy_apk.sh
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
APK_SOURCE="frontend/android/app/build/outputs/apk/debug/app-debug.apk"
|
||||
APK_DEST="backend/static/StreamFlix-Universal-v1.0.8.apk"
|
||||
HTML_FILE="backend/static/download.html"
|
||||
|
||||
echo "🚀 Deploying Android APK v1.0.8..."
|
||||
|
||||
# 1. Check if APK exists
|
||||
if [ ! -f "$APK_SOURCE" ]; then
|
||||
echo "❌ APK build not found at $APK_SOURCE"
|
||||
echo " Please wait for the build to finish."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 2. Move and Rename APK
|
||||
echo "📦 Moving APK to static folder..."
|
||||
cp "$APK_SOURCE" "$APK_DEST"
|
||||
# Remove old APK if exists
|
||||
rm -f "backend/static/StreamFlix-Universal-v1.0.6.apk"
|
||||
|
||||
# 3. Update Download Page
|
||||
echo "📝 Updating download.html..."
|
||||
# Use perl for cross-platform regex replacement (handles Mac/Linux nuances better than sed)
|
||||
perl -i -pe 's/v1\.0\.6/v1.0.8/g' "$HTML_FILE"
|
||||
|
||||
# 4. Git Commit & Push
|
||||
echo "octocat: Committing to GitHub..."
|
||||
git add "$APK_DEST" "$HTML_FILE"
|
||||
git commit -m "v1.0.8: Added Android APK to static assets"
|
||||
git push origin main
|
||||
|
||||
echo ""
|
||||
echo "✅ DEPLOYMENT SUCCESSFUL!"
|
||||
echo "------------------------------------------------"
|
||||
echo "👉 Next Step: Update your NAS Docker container."
|
||||
echo " docker pull vndangkhoa/streamflix:1.0.8"
|
||||
echo " (or rebuild if you are building locally)"
|
||||
echo "------------------------------------------------"
|
||||
|
|
@ -69,13 +69,21 @@ export function initPlayer(container, options = {}) {
|
|||
theme: '#f5c518', // Golden-yellow accent
|
||||
lang: 'en',
|
||||
moreVideoAttr: {
|
||||
crossOrigin: 'anonymous',
|
||||
// crossOrigin: 'anonymous',
|
||||
preload: 'auto',
|
||||
},
|
||||
airplay: true,
|
||||
// HLS custom configuration for better buffering
|
||||
customType: {
|
||||
m3u8: function playM3u8(video, url, art) {
|
||||
// Check if Android - prefer native HLS to avoid CORS/hls.js issues
|
||||
const isAndroid = /Android/i.test(navigator.userAgent);
|
||||
|
||||
if (isAndroid && video.canPlayType('application/vnd.apple.mpegurl')) {
|
||||
video.src = url;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Hls.isSupported()) {
|
||||
if (art.hls) {
|
||||
art.hls.destroy();
|
||||
|
|
|
|||
Loading…
Reference in a new issue