1.使用npm下載依賴
npm install --save easy-player
2.將EasyPlayer-lib.min.js文件、EasyPlayer.wasm文件、libDecoder.wasm文件放置到public下
3.創(chuàng)建components,html代碼如下
<template>
<div class="player-box" :style="{ width: width, height: height }">
<EasyPlayer
style="width: 100%; height: 100%"
:videoUrl="videoUrl"
:showEnterprise="false"
:show-custom-button="false"
:autoplay="true"
/>
</div>
</template>
4.使用props接收數(shù)據(jù)文章來源:http://www.zghlxwxcb.cn/news/detail-768366.html
props: {
// 視頻地址
videoUrl: {
type: String,
default: "",
},
// 容器id
id: {
type: String,
default: "",
},
// 容器寬度
width: {
type: [Number, String],
default: "100%",
},
// 容器高度
height: {
type: [Number, String],
default: "100%",
},
},
5.在父組件中引入,傳遞props中的數(shù)據(jù)即可運(yùn)行即可文章來源地址http://www.zghlxwxcb.cn/news/detail-768366.html
到了這里,關(guān)于vue中使用EasyPlayer播放監(jiān)控視頻HLS,H265、H264的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!