vue3-video-player摄像机拉流
时间: 2023-11-21 15:56:21 浏览: 101
以下是使用vue3-video-player组件进行摄像机拉流的示例代码:
1.首先需要安装vue3-video-player组件:
```shell
npm install vue3-video-player --save
```
2.在Vue组件中引入videoPlayer组件:
```javascript
<template>
<div>
<video-player :options="playerOptions"></video-player>
</div>
</template>
<script>
import { defineComponent } from 'vue'
import 'video.js/dist/video-js.css'
import 'vue3-video-player/dist/style.css'
import videoPlayer from 'vue3-video-player'
export default defineComponent({
name: 'rtmpPlay',
components: {
videoPlayer
},
data() {
return {
playerOptions: {
autoplay: true,
controls: true,
sources: [{
src: 'rtmp://your_camera_address',
type: 'rtmp/flv'
}]
}
}
}
})
</script>
```
3.在data中设置playerOptions,其中sources中的src需要替换成你的摄像机地址。
阅读全文