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.
|
||||
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.
|
||||
if (
|
||||
k.includes('\u89c6\u9891') ||
|
||||
@ -359,6 +372,16 @@ function looksLikeVideoOption(option: unknown): boolean {
|
||||
'sourceUrl',
|
||||
'liveUrl',
|
||||
'streamUrl',
|
||||
// very common forks / camera widgets
|
||||
'rtspUrl',
|
||||
'rtmpUrl',
|
||||
'hlsUrl',
|
||||
'flvUrl',
|
||||
'm3u8Url',
|
||||
'cameraUrl',
|
||||
'cctvUrl',
|
||||
'monitorUrl',
|
||||
// format keys
|
||||
'mp4',
|
||||
'm3u8',
|
||||
'flv',
|
||||
|
||||
@ -127,7 +127,28 @@ function pickFirstUrlFromList(input: unknown): string {
|
||||
// - { src/url/value }
|
||||
// - { playUrl }
|
||||
// - { 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];
|
||||
if (typeof v === 'string' && v) return v;
|
||||
}
|
||||
@ -152,6 +173,16 @@ function pickSrc(option: GoViewVideoOption): string {
|
||||
// common explicit keys
|
||||
'videoUrl',
|
||||
'videoSrc',
|
||||
'playUrl',
|
||||
// fork/camera widgets often use *Url suffixes
|
||||
'rtspUrl',
|
||||
'rtmpUrl',
|
||||
'hlsUrl',
|
||||
'flvUrl',
|
||||
'm3u8Url',
|
||||
'cameraUrl',
|
||||
'cctvUrl',
|
||||
'monitorUrl',
|
||||
// format-specific keys
|
||||
'm3u8',
|
||||
'hls',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user