vue-video-player播放rtmp
时间: 2023-06-05 17:47:07 浏览: 329
Vue-video-player可以播放RTMP流媒体,需要使用video.js的插件videojs-flash和videojs-contrib-hls。在Vue项目中安装这两个插件后,可以使用以下代码播放RTMP流媒体:
```
<template>
<div>
<video-player ref="player" :options="playerOptions"></video-player>
</div>
</template>
<script>
import 'video.js/dist/video-js.css'
import 'vue-video-player/src/custom-theme.css'
import VideoPlayer from 'vue-video-player'
import 'videojs-flash'
import 'videojs-contrib-hls'
export default {
components: {
VideoPlayer
},
data() {
return {
playerOptions: {
autoplay: true,
controls: true,
sources: [{
type: 'rtmp/mp4',
src: 'rtmp://example.com/live/stream'
}]
}
}
}
}
</script>
```
其中,sources中的src需要替换成实际的RTMP流媒体地址。
阅读全文
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)