diff --git a/src/components/VideoPlayer/src/VideoPlayer.vue b/src/components/VideoPlayer/src/VideoPlayer.vue index 4fd639a4a..83c8d30ba 100644 --- a/src/components/VideoPlayer/src/VideoPlayer.vue +++ b/src/components/VideoPlayer/src/VideoPlayer.vue @@ -21,7 +21,7 @@ const videoEl = ref() const intiPlayer = () => { if (!unref(videoEl)) return - new Player({ + playerRef.value = new Player({ autoplay: false, ...props, el: unref(videoEl) diff --git a/src/utils/is.ts b/src/utils/is.ts index 8ac2e50d0..16514205a 100644 --- a/src/utils/is.ts +++ b/src/utils/is.ts @@ -95,9 +95,12 @@ export const isServer = typeof window === 'undefined' export const isClient = !isServer export const isUrl = (path: string): boolean => { - const reg = - /(((^https?:(?:\/\/)?)(?:[-:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&%@.\w_]*)#?(?:[\w]*))?)$/ - return reg.test(path) + try { + new URL(path) + return true + } catch (_error) { + return false + } } export const isDark = (): boolean => {