Skip to content

Commit fd7a6bd

Browse files
mixelburgclaude
andcommitted
feat(VVideo): support v-model:error for bi-directional error binding
The error prop now syncs both ways — internal video errors set the model, and parent can set error externally. Retry clears the model. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 50c2cd3 commit fd7a6bd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/vuetify/src/labs/VVideo/VVideo.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export const VVideo = genericComponent<VVideoSlots>()({
9393
error: (event: Event) => true,
9494
retry: () => true,
9595
loaded: (element: HTMLVideoElement) => true,
96+
'update:error': (val: boolean) => true,
9697
'update:playing': (val: boolean) => true,
9798
'update:progress': (val: number) => true,
9899
'update:volume': (val: number) => true,
@@ -122,6 +123,7 @@ export const VVideo = genericComponent<VVideoSlots>()({
122123
const waiting = shallowRef(false)
123124
const triggered = shallowRef(false)
124125
const startAfterLoad = shallowRef(false)
126+
const errorModel = useProxiedModel(props, 'error')
125127
const state = shallowRef<'idle' | 'loading' | 'loaded' | 'error'>(props.autoplay ? 'loading' : 'idle')
126128
const duration = shallowRef(0)
127129

@@ -161,10 +163,11 @@ export const VVideo = genericComponent<VVideoSlots>()({
161163

162164
function onVideoError (e: Event) {
163165
state.value = 'error'
166+
errorModel.value = true
164167
emit('error', e)
165168
}
166169

167-
watch(() => props.error, v => {
170+
watch(errorModel, v => {
168171
if (v && state.value !== 'error') {
169172
videoRef.value?.pause()
170173
state.value = 'error'
@@ -175,6 +178,7 @@ export const VVideo = genericComponent<VVideoSlots>()({
175178
if (state.value === 'error') {
176179
// Retry: reload the video element
177180
state.value = 'loading'
181+
errorModel.value = false
178182
videoRef.value?.load()
179183
emit('retry')
180184
return

0 commit comments

Comments
 (0)