vue在谷歌浏览器打开rtmp流

编程入门 行业动态 更新时间:2024-10-21 13:23:45

vue在谷歌<a href=https://www.elefans.com/category/jswz/34/1770995.html style=浏览器打开rtmp流"/>

vue在谷歌浏览器打开rtmp流

vue在谷歌浏览器打开rtmp流
1.先启动一个vue项目
2.安装依赖
cnpm install videojs-flash --save

cnpm install vue-video-player -S
3.在main.js中全局引入
import VideoPlayer from ‘vue-video-player’
import ‘video.js/dist/video-js.css’
import ‘videojs-flash’
Vue.use(VideoPlayer)
4.在页面中填写

<template><div><video-player ref="videoPlayer" :options="videoOptions" class="vjs-custom-skin videoPlayer" :playsinline="true"></video-player></div>	</template><script>import { videoPlayer } from 'vue-video-player'
import 'video.js/dist/video-js.css'import 'videojs-flash'export default {components: {
videoPlayer
},//完整的配置数据(不要的可以直接注释掉)
data(){return {videoOptions: {live: true,autoplay: true,fluid: true,notSupportedMessage: '暂时无法播放',controlBar: {timeDivider: true,durationDisplay: true,remainingTimeDisplay: false,fullscreenToggle: true // 全屏按钮},techOrder: ['flash'],sources: [{ // 流配置,数组形式,会根据兼容顺序自动切换type: 'rtmp/mp4',src: 'rtmp://58.200.131.2:1935/livetv/hunantv' //这是芒果TV现场直播视频,地址是可以用的,最后需要替换成后端给的项目地址}]}}
},methods:{}}</script>

5.打开谷歌浏览器的flash限制

更多推荐

vue在谷歌浏览器打开rtmp流

本文发布于:2024-02-27 05:19:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1705326.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:浏览器   vue   rtmp

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!