🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[TOC] ## useMediaControls ``` <script setup lang="ts"> import { onMounted, ref } from 'vue' import { useMediaControls } from '@vueuse/core' const video = ref() const { playing, currentTime, duration, volume } = useMediaControls(video, { src: 'video.mp4', }) // Change initial media properties onMounted(() => { volume.value = 0.5 currentTime.value = 60 }) </script> <template> <video ref="video" /> <button @click="playing = !playing">Play / Pause</button> <span>{{ currentTime }} / {{ duration }}</span> </template> ```