Add video player with autoplay, DASH streaming and mobile UI support
All checks were successful
Build and release container directly from master / release (push) Successful in 5m26s

This commit is contained in:
knight 2025-05-05 14:20:21 -04:00
parent 9a83674a42
commit 7a750167eb

View File

@ -57,6 +57,44 @@ var player;
try { try {
player = videojs('player', options); player = videojs('player', options);
console.log('[Invidious Debug] videojs initialized successfully.'); console.log('[Invidious Debug] videojs initialized successfully.');
// --- START WebOS DASH Workaround ---
var isWebOS = /Web[O0]S|LG Browser/i.test(navigator.userAgent);
console.log('[Invidious Debug] Checking for WebOS. User Agent:', navigator.userAgent, 'Is WebOS:', isWebOS);
if (isWebOS && video_data.params.quality === 'dash') {
console.log('[Invidious Debug] WebOS detected with DASH quality. Attempting to filter sources.');
// It might be too early here, sources might not be fully set.
// Let's try removing the source later, maybe on 'canplay' or 'sourceset' if needed.
// For now, just log the detection. We might need to hook into an event.
// --- Alternative: Try filtering sources immediately (might not work) ---
try {
let currentSources = player.currentSources();
console.log('[Invidious Debug] WebOS: Sources before filter:', JSON.stringify(currentSources));
let filteredSources = currentSources.filter(function(source) {
return source.type !== 'application/dash+xml';
});
// Set filtered sources if different, find the non-DASH source
if (filteredSources.length > 0 && filteredSources.length < currentSources.length) {
console.log('[Invidious Debug] WebOS: Sources after filter:', JSON.stringify(filteredSources));
// Select the first non-DASH source explicitly
let mp4Source = filteredSources.find(s => s.type.startsWith('video/mp4'));
if (mp4Source) {
console.log('[Invidious Debug] WebOS: Setting source explicitly to MP4:', JSON.stringify(mp4Source));
player.src(mp4Source); // Try setting the source directly
} else {
console.warn('[Invidious Debug] WebOS: No suitable MP4 source found after filtering DASH.');
}
} else {
console.log('[Invidious Debug] WebOS: No DASH source found to filter, or no other sources available.');
}
} catch (e) {
console.error('[Invidious Debug] WebOS: Error filtering sources:', e);
}
}
// --- END WebOS DASH Workaround ---
} catch (e) { } catch (e) {
console.error('[Invidious Debug] videojs initialization FAILED:', e); console.error('[Invidious Debug] videojs initialization FAILED:', e);
// Stop further execution if player init fails // Stop further execution if player init fails
@ -104,7 +142,6 @@ player.on('error', function () {
} }
}); });
/* // Temporarily disabled for WebOS MP4 test - START
if (video_data.params.quality === 'dash') { if (video_data.params.quality === 'dash') {
console.log('[Invidious Debug] Initializing reloadSourceOnError...'); console.log('[Invidious Debug] Initializing reloadSourceOnError...');
try { try {
@ -116,7 +153,6 @@ if (video_data.params.quality === 'dash') {
console.error('[Invidious Debug] reloadSourceOnError FAILED:', e); console.error('[Invidious Debug] reloadSourceOnError FAILED:', e);
} }
} }
*/ // Temporarily disabled for WebOS MP4 test - END
/** /**
* Function for add time argument to url * Function for add time argument to url
@ -312,7 +348,6 @@ if (video_data.params.autoplay) {
}); });
} }
/* // Temporarily disabled for WebOS MP4 test - START
if (!video_data.params.listen && video_data.params.quality === 'dash') { if (!video_data.params.listen && video_data.params.quality === 'dash') {
console.log('[Invidious Debug] Initializing httpSourceSelector...'); console.log('[Invidious Debug] Initializing httpSourceSelector...');
console.log('[Invidious Debug] Player sources BEFORE httpSourceSelector init:', JSON.stringify(player.currentSources())); console.log('[Invidious Debug] Player sources BEFORE httpSourceSelector init:', JSON.stringify(player.currentSources()));
@ -359,7 +394,6 @@ if (!video_data.params.listen && video_data.params.quality === 'dash') {
console.error('[Invidious Debug] httpSourceSelector FAILED:', e); console.error('[Invidious Debug] httpSourceSelector FAILED:', e);
} }
} }
*/ // Temporarily disabled for WebOS MP4 test - END
console.log('[Invidious Debug] Initializing vttThumbnails...'); console.log('[Invidious Debug] Initializing vttThumbnails...');
try { try {