From 77f6412a24aa0381b2b3ea1cd4372d0b57349ef2 Mon Sep 17 00:00:00 2001 From: Page Asgardius Date: Wed, 18 Sep 2024 13:36:07 -0700 Subject: [PATCH] mimetype --- src/App.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/App.js b/src/App.js index f5a8036..510fd95 100644 --- a/src/App.js +++ b/src/App.js @@ -9,7 +9,16 @@ import VideoJS from './VideoJS'; const App = () => { const playerRef = React.useRef(null); const searchParams = new URLSearchParams(document.location.search) - + var mimetype + if (!searchParams.get('mime' ) === "") { + mimetype = searchParams.get('mime') + } + else if (searchParams.get('video').endsWith('oga') || searchParams.get('video').endsWith('ogg') || searchParams.get('video').endsWith("opus")) { + mimetype = 'audio/ogg' + } + else if (searchParams.get('video').endsWith("m3u8")) { + mimetype = 'application/x-mpegURL' + } const videoJsOptions = { autoplay: false, controls: true, @@ -17,7 +26,7 @@ const App = () => { fluid: true, sources: [{ src: searchParams.get('video'), - type: searchParams.get('mime') + type: mimetype }] };