feat(sdk): broaden goView video detection
This commit is contained in:
parent
ab84000919
commit
9202aed333
@ -173,6 +173,19 @@ function isVideo(c: GoViewComponentLike): boolean {
|
|||||||
// Misspellings / aliases seen in forks.
|
// Misspellings / aliases seen in forks.
|
||||||
if (k.includes('vedio')) return true;
|
if (k.includes('vedio')) return true;
|
||||||
|
|
||||||
|
// Other common widget key aliases (varies a lot across forks).
|
||||||
|
if (
|
||||||
|
k.includes('videoplayer') ||
|
||||||
|
k.includes('video_player') ||
|
||||||
|
k.includes('player_video') ||
|
||||||
|
k.includes('liveplayer') ||
|
||||||
|
k.includes('live_player') ||
|
||||||
|
k.includes('streamplayer') ||
|
||||||
|
k.includes('stream_player')
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Chinese low-code widget names.
|
// Chinese low-code widget names.
|
||||||
if (
|
if (
|
||||||
k.includes('\u89c6\u9891') ||
|
k.includes('\u89c6\u9891') ||
|
||||||
@ -359,6 +372,16 @@ function looksLikeVideoOption(option: unknown): boolean {
|
|||||||
'sourceUrl',
|
'sourceUrl',
|
||||||
'liveUrl',
|
'liveUrl',
|
||||||
'streamUrl',
|
'streamUrl',
|
||||||
|
// very common forks / camera widgets
|
||||||
|
'rtspUrl',
|
||||||
|
'rtmpUrl',
|
||||||
|
'hlsUrl',
|
||||||
|
'flvUrl',
|
||||||
|
'm3u8Url',
|
||||||
|
'cameraUrl',
|
||||||
|
'cctvUrl',
|
||||||
|
'monitorUrl',
|
||||||
|
// format keys
|
||||||
'mp4',
|
'mp4',
|
||||||
'm3u8',
|
'm3u8',
|
||||||
'flv',
|
'flv',
|
||||||
|
|||||||
@ -127,7 +127,28 @@ function pickFirstUrlFromList(input: unknown): string {
|
|||||||
// - { src/url/value }
|
// - { src/url/value }
|
||||||
// - { playUrl }
|
// - { playUrl }
|
||||||
// - { mp4/m3u8/flv/hls/rtsp/rtmp }
|
// - { mp4/m3u8/flv/hls/rtsp/rtmp }
|
||||||
for (const key of ['mp4', 'm3u8', 'flv', 'hls', 'rtsp', 'rtmp', 'videoUrl', 'videoSrc', 'playUrl', 'src', 'url', 'value']) {
|
for (const key of [
|
||||||
|
'mp4',
|
||||||
|
'm3u8',
|
||||||
|
'flv',
|
||||||
|
'hls',
|
||||||
|
'rtsp',
|
||||||
|
'rtmp',
|
||||||
|
'videoUrl',
|
||||||
|
'videoSrc',
|
||||||
|
'playUrl',
|
||||||
|
'rtspUrl',
|
||||||
|
'rtmpUrl',
|
||||||
|
'hlsUrl',
|
||||||
|
'flvUrl',
|
||||||
|
'm3u8Url',
|
||||||
|
'cameraUrl',
|
||||||
|
'cctvUrl',
|
||||||
|
'monitorUrl',
|
||||||
|
'src',
|
||||||
|
'url',
|
||||||
|
'value',
|
||||||
|
]) {
|
||||||
const v = obj[key];
|
const v = obj[key];
|
||||||
if (typeof v === 'string' && v) return v;
|
if (typeof v === 'string' && v) return v;
|
||||||
}
|
}
|
||||||
@ -152,6 +173,16 @@ function pickSrc(option: GoViewVideoOption): string {
|
|||||||
// common explicit keys
|
// common explicit keys
|
||||||
'videoUrl',
|
'videoUrl',
|
||||||
'videoSrc',
|
'videoSrc',
|
||||||
|
'playUrl',
|
||||||
|
// fork/camera widgets often use *Url suffixes
|
||||||
|
'rtspUrl',
|
||||||
|
'rtmpUrl',
|
||||||
|
'hlsUrl',
|
||||||
|
'flvUrl',
|
||||||
|
'm3u8Url',
|
||||||
|
'cameraUrl',
|
||||||
|
'cctvUrl',
|
||||||
|
'monitorUrl',
|
||||||
// format-specific keys
|
// format-specific keys
|
||||||
'm3u8',
|
'm3u8',
|
||||||
'hls',
|
'hls',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user