mirror of
https://github.com/bytedream/stream-bypass.git
synced 2025-12-16 00:40:43 +01:00
Use enum to specify media type
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { matches } from '~/lib/match';
|
||||
import {matches, MatchMediaType} from '~/lib/match';
|
||||
import Hls from 'hls.js';
|
||||
import { UrlReferer } from '~/lib/settings';
|
||||
import {UrlReferer} from '~/lib/settings';
|
||||
|
||||
async function playNative(url: string, domain: string, videoElem: HTMLVideoElement) {
|
||||
await UrlReferer.set(new URL(url).hostname, domain);
|
||||
@@ -31,7 +31,7 @@ export async function play(videoElem: HTMLVideoElement) {
|
||||
const id = urlQuery.get('id') as string;
|
||||
const url = decodeURIComponent(urlQuery.get('url') as string);
|
||||
const domain = urlQuery.get('domain') as string;
|
||||
const urlType = urlQuery.get('urlType') as string;
|
||||
const urlType = urlQuery.get('urlType') as MatchMediaType;
|
||||
|
||||
const match = matches[id];
|
||||
if (match === undefined) {
|
||||
@@ -39,9 +39,9 @@ export async function play(videoElem: HTMLVideoElement) {
|
||||
}
|
||||
document.title = `Stream Bypass (${domain})`;
|
||||
|
||||
if (urlType === 'hls') {
|
||||
if (urlType === MatchMediaType.Hls) {
|
||||
await playHls(url, domain, videoElem);
|
||||
} else if (urlType === 'native') {
|
||||
} else if (urlType === MatchMediaType.Native) {
|
||||
await playNative(url, domain, videoElem);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user