@bagelink/vue 1.4.62 → 1.4.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/BglVideo.vue.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/BglVideo.vue +16 -21
package/package.json
CHANGED
|
@@ -66,7 +66,7 @@ defineExpose({ play, pause })
|
|
|
66
66
|
const embedType = $computed<'YouTube' | 'Vimeo' | undefined>(() => {
|
|
67
67
|
const youtubeRegex = /youtube\.com|youtu\.be/
|
|
68
68
|
if (youtubeRegex.test(props.src || '')) return 'YouTube'
|
|
69
|
-
const vimeoRegex = /vimeo\.com/
|
|
69
|
+
const vimeoRegex = /(?:player\.)?vimeo\.com/
|
|
70
70
|
if (vimeoRegex.test(props.src || '')) return 'Vimeo'
|
|
71
71
|
})
|
|
72
72
|
|
|
@@ -90,10 +90,15 @@ const videoUrl = $computed(() => {
|
|
|
90
90
|
return `https://www.youtube.com/embed/${videoId}?${queryParams}`
|
|
91
91
|
}
|
|
92
92
|
if (embedType === 'Vimeo') {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
// Handle both regular Vimeo URLs and player.vimeo.com embed URLs
|
|
94
|
+
const playerVimeoRegex = /player\.vimeo\.com\/video\/(\d+)/
|
|
95
|
+
const regularVimeoRegex = /vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|album\/(\d+)\/video\/)?(\d+)(?:$|\/|\?)/
|
|
96
|
+
|
|
97
|
+
const playerMatch = props.src?.match(playerVimeoRegex)
|
|
98
|
+
const regularMatch = props.src?.match(regularVimeoRegex)
|
|
99
|
+
|
|
100
|
+
const videoId = playerMatch?.[1] || regularMatch?.[3]
|
|
101
|
+
console.log(videoId, { playerMatch, regularMatch })
|
|
97
102
|
return `https://player.vimeo.com/video/${videoId}`
|
|
98
103
|
}
|
|
99
104
|
}
|
|
@@ -104,24 +109,13 @@ const videoUrl = $computed(() => {
|
|
|
104
109
|
<template>
|
|
105
110
|
<div ref="videoContainer" class="bgl_vid" :class="{ vid_empty: !src, vid_short: isYoutubeShort }">
|
|
106
111
|
<iframe
|
|
107
|
-
v-if="embedType"
|
|
108
|
-
:src="videoUrl"
|
|
109
|
-
:style="{ aspectRatio }"
|
|
110
|
-
frameborder="0"
|
|
111
|
-
title="Video"
|
|
112
|
+
v-if="embedType" :src="videoUrl" :style="{ aspectRatio }" frameborder="0" title="Video"
|
|
112
113
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
|
113
|
-
referrerpolicy="strict-origin-when-cross-origin"
|
|
114
|
-
allowfullscreen
|
|
114
|
+
referrerpolicy="strict-origin-when-cross-origin" allowfullscreen
|
|
115
115
|
/>
|
|
116
116
|
<video
|
|
117
|
-
v-else-if="src"
|
|
118
|
-
|
|
119
|
-
:autoplay="autoplay === true"
|
|
120
|
-
:muted="mute"
|
|
121
|
-
:loop="loop"
|
|
122
|
-
:style="{ aspectRatio }"
|
|
123
|
-
:controls="controls"
|
|
124
|
-
:playsinline="playsinline"
|
|
117
|
+
v-else-if="src" ref="video" :autoplay="autoplay === true" :muted="mute" :loop="loop"
|
|
118
|
+
:style="{ aspectRatio }" :controls="controls" :playsinline="playsinline"
|
|
125
119
|
>
|
|
126
120
|
<source :src="src" :type="`video/${videoFormat}`">
|
|
127
121
|
</video>
|
|
@@ -145,7 +139,8 @@ const videoUrl = $computed(() => {
|
|
|
145
139
|
}
|
|
146
140
|
|
|
147
141
|
.bgl_vid.vid_short {
|
|
148
|
-
max-width: 56.25vh;
|
|
142
|
+
max-width: 56.25vh;
|
|
143
|
+
/* Limit width for shorts to maintain aspect ratio */
|
|
149
144
|
margin: 0 auto;
|
|
150
145
|
}
|
|
151
146
|
</style>
|