From 9202aed333ceb024d4817d5589fda3b44eff4bf2 Mon Sep 17 00:00:00 2001 From: clawdbot Date: Wed, 28 Jan 2026 16:37:26 +0800 Subject: [PATCH] feat(sdk): broaden goView video detection --- packages/sdk/src/core/goview/convert.ts | 23 +++++++++++++++++ packages/sdk/src/core/widgets/video.ts | 33 ++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/packages/sdk/src/core/goview/convert.ts b/packages/sdk/src/core/goview/convert.ts index 168b4ef..6a77e36 100644 --- a/packages/sdk/src/core/goview/convert.ts +++ b/packages/sdk/src/core/goview/convert.ts @@ -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', diff --git a/packages/sdk/src/core/widgets/video.ts b/packages/sdk/src/core/widgets/video.ts index a737e75..8ca2e1f 100644 --- a/packages/sdk/src/core/widgets/video.ts +++ b/packages/sdk/src/core/widgets/video.ts @@ -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',