Commit cf9200f5ed751325ccc799a878521fc52b936604
Merge branch 'perf/video-component' into 'main_dev'
perf: 优化手动输入流地址携带参数时无法获取视频协议类型 See merge request yunteng/thingskit-scada!230
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')) | ... | ... |