1、安装依赖:cnpm i flv.js
2、新建一个视频组件VideoBounce.vue,该组件里有flv.js实现视频播放完整代码
<template>
<div class="video-bounce relative">
<div class="header">
<div class="name">
{
{ store.name }}
</div>
</div>
<video :id="id" class="video" ref="vBox"></video>
<img @click="hideVideo" src="@/assets/images/close.png" class="close" alt="">
<img v-if="play === true" src="@/assets/images/loading.png" class="loading absolute" alt="">
<img src="@/assets/images/full.png" @click="requestFull" class="enlarge" alt="">
<div v-if="fail === true" class="error-box absolute flex flex-col items-center justify-center">
<img src="@/assets/images/error.png" class="error" alt="">
<div class="text">播放失败<