mimetype
This commit is contained in:
parent
45189a5247
commit
77f6412a24
1 changed files with 11 additions and 2 deletions
13
src/App.js
13
src/App.js
|
@ -9,7 +9,16 @@ import VideoJS from './VideoJS';
|
||||||
const App = () => {
|
const App = () => {
|
||||||
const playerRef = React.useRef(null);
|
const playerRef = React.useRef(null);
|
||||||
const searchParams = new URLSearchParams(document.location.search)
|
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 = {
|
const videoJsOptions = {
|
||||||
autoplay: false,
|
autoplay: false,
|
||||||
controls: true,
|
controls: true,
|
||||||
|
@ -17,7 +26,7 @@ const App = () => {
|
||||||
fluid: true,
|
fluid: true,
|
||||||
sources: [{
|
sources: [{
|
||||||
src: searchParams.get('video'),
|
src: searchParams.get('video'),
|
||||||
type: searchParams.get('mime')
|
type: mimetype
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue