vue3?使用?vue3-video-play實現(xiàn)在線視頻播放
更新時間:2023年06月26日 14:22:25 作者:逆風優(yōu)雅
這篇文章主要介紹了vue3?使用?vue3-video-play?進行在線視頻播放,本文通過實例代碼給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
首先:下載依賴
npm i vue3-video-play --save 或 yarn add vue3-video-play
其次:在項目的組件中使用
<script lang="ts"> import { videoPlay } from 'vue3-video-play' // 引入視頻播放的組件 import 'vue3-video-play/dist/style.css' // 引入相關(guān)的css export default defineComponent({ name: "TypicalExampleIndex", components: { // 注冊成為子組件 videoPlay }, setup(){} }) </script>
使用:
<div class="map-content"> <videoPlay class="my-video" ref="videoPlayer" v-bind="playerOptions" :playsinline="true"> </videoPlay> </div> 其中v-bind 后面的playerOptions為視頻播放的相關(guān)配置信息 playerOptions: { width: "852px", //播放器高度 height: "588px", //播放器高度 color: "#0e5f6d", //主題色 title: "", //視頻名稱 muted: false, //靜音 webFullScreen: false, speedRate: ["0.75", "1.0", "1.25", "1.5", "2.0"], //播放倍速 autoPlay: false, //自動播放 loop: false, //循環(huán)播放 mirror: false, //鏡像畫面 ligthOff: false, //關(guān)燈模式 volume: 0.5, //默認音量大小 control: true, //是否顯示控制 poster: '', controlBtns: [ "audioTrack", "quality", "speedRate", "volume", "pip", "fullScreen", ], //顯示所有按鈕, src: "http://www.baidu.mp4", // 視頻在線地址 }
最終的視頻播放頁面效果圖
到此這篇關(guān)于vue3 使用 vue3-video-play 進行在線視頻播放的文章就介紹到這了,更多相關(guān)vue3-video-play在線視頻播放內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Vite配置優(yōu)雅的code?spliiting代碼分割詳解
這篇文章主要為大家介紹了Vite配置優(yōu)雅的code?spliiting代碼分割詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2022-08-08window.onresize在vue中只能使用一次,自適應(yīng)resize報錯問題
這篇文章主要介紹了window.onresize在vue中只能使用一次,自適應(yīng)resize報錯問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2023-10-10vue在自定義組件中使用v-model進行數(shù)據(jù)綁定的方法
這篇文章主要介紹了vue在自定義組件中使用v-model進行數(shù)據(jù)綁定的方法,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2019-03-03