Vue NativeVue Native
Guide
Components
Composables
Navigation
  • iOS
  • Android
  • macOS
GitHub
Guide
Components
Composables
Navigation
  • iOS
  • Android
  • macOS
GitHub
  • Layout

    • VView
    • VScrollView
    • VSafeArea
    • VKeyboardAvoiding
  • Text & Input

    • VText
    • VInput
  • Interactive

    • VButton
    • VPressable
    • VSwitch
    • VSlider
    • VSegmentedControl
    • VCheckbox
    • VRadio
    • VDropdown
    • VRefreshControl
  • Media

    • VImage
    • VWebView
    • VVideo
  • Lists

    • VList
    • VFlatList
    • VSectionList
  • Feedback

    • VActivityIndicator
    • VProgressBar
    • VAlertDialog
    • VActionSheet
    • VModal
    • VErrorBoundary
  • Transition & State

    • VTransition & VTransitionGroup
    • KeepAlive
    • VSuspense
  • Navigation

    • VNavigationBar
    • VTabBar
  • System

    • VStatusBar
    • VPicker
  • macOS

    • VToolbar
    • VSplitView
    • VOutlineView

VVideo

A video player component. Maps to AVPlayer on iOS and MediaPlayer on Android.

Supports streaming and local video playback with built-in transport controls.

Usage

<VVideo
  :source="{ uri: 'https://example.com/video.mp4' }"
  :controls="true"
  :style="{ width: '100%', aspectRatio: 16 / 9 }"
/>

Props

PropTypeDefaultDescription
source{ uri: string }--Video source object containing a uri string
autoplayBooleanfalseAutomatically begins playback when the source is ready
loopBooleanfalseRestarts playback from the beginning when it reaches the end
mutedBooleanfalseMutes audio output
pausedBooleanfalsePauses playback when true
controlsBooleantrueShows native transport controls (play/pause, seek, fullscreen)
volumeNumber1.0Audio volume from 0.0 (silent) to 1.0 (full)
resizeMode'cover' | 'contain' | 'stretch' | 'center''cover'How the video is scaled within the frame
posterString--URL of a poster image displayed before playback starts
styleViewStyle--Layout + appearance styles
testIDString--Test identifier for end-to-end testing
accessibilityLabelString--Accessibility label read by screen readers

Events

EventPayloadDescription
ready--Emitted when the video is loaded and ready to play
play--Emitted when playback starts or resumes
pause--Emitted when playback is paused
end--Emitted when playback reaches the end
error{ message: string }Emitted when a playback error occurs
progress{ currentTime: number, duration: number }Emitted periodically during playback with time information

Example

<script setup>
import { ref } from '@thelacanians/vue-native-runtime'

const isPaused = ref(true)
const progress = ref(0)
const duration = ref(0)

function onProgress({ currentTime, duration: dur }) {
  progress.value = currentTime
  duration.value = dur
}

function formatTime(seconds) {
  const m = Math.floor(seconds / 60)
  const s = Math.floor(seconds % 60)
  return `${m}:${s.toString().padStart(2, '0')}`
}
</script>

<template>
  <VView :style="{ flex: 1, backgroundColor: '#000' }">
    <VVideo
      :source="{ uri: 'https://example.com/sample-video.mp4' }"
      :paused="isPaused"
      :controls="true"
      resizeMode="contain"
      poster="https://example.com/poster.jpg"
      :style="{ width: '100%', aspectRatio: 16 / 9 }"
      @ready="() => console.log('Video ready')"
      @play="() => (isPaused = false)"
      @pause="() => (isPaused = true)"
      @end="() => (isPaused = true)"
      @error="(e) => console.warn('Playback error:', e.message)"
      @progress="onProgress"
    />

    <VView :style="{ padding: 16, gap: 12 }">
      <VText :style="{ color: '#fff', fontSize: 13 }">
        {{ formatTime(progress) }} / {{ formatTime(duration) }}
      </VText>

      <VButton
        :style="{
          backgroundColor: '#fff',
          padding: 12,
          borderRadius: 8,
          alignItems: 'center',
        }"
        :onPress="() => (isPaused = !isPaused)"
      >
        <VText :style="{ fontWeight: '600' }">
          {{ isPaused ? 'Play' : 'Pause' }}
        </VText>
      </VButton>
    </VView>
  </VView>
</template>
Edit this page
Last Updated: 2/28/26, 11:24 PM
Contributors: Abdul Hamid, Claude Opus 4.6
Prev
VWebView