Commit 1d6d6911deda85b8fc31d019b1fc6548623c4c6c
Merge branch 'main_dev' into 'main'
Main dev See merge request yunteng/thingskit-scada!231
Showing
1 changed file
with
10 additions
and
0 deletions
| ... | ... | @@ -22,7 +22,17 @@ const emits = defineEmits<{ |
| 22 | 22 | (eventName: 'onUnmounted', player: PresetPlayer): void |
| 23 | 23 | }>() |
| 24 | 24 | |
| 25 | +function parsePlayUrl(url: string) { | |
| 26 | + try { | |
| 27 | + return new URL(url).pathname | |
| 28 | + } | |
| 29 | + catch { | |
| 30 | + return url | |
| 31 | + } | |
| 32 | +} | |
| 33 | + | |
| 25 | 34 | function getStreamTypeByUrl(url = ''): StreamType | undefined { |
| 35 | + url = parsePlayUrl(url) || '' | |
| 26 | 36 | if (url.endsWith('.m3u8')) return 'hls' |
| 27 | 37 | else if (url.endsWith('.mp4')) return 'mp4' |
| 28 | 38 | else if (url.endsWith('.flv')) | ... | ... |