当前位置: 首页 > news >正文

【vue Dplayer】播放hls视频流

准备工作

  1. 安装Dplayer和hls.js
npm install dplayer --save
npm install hls.js --save
  1. 准备测试流
    hls测试地址:(截止2023.08.08有效)
    http://playertest.longtailvideo.com/adaptive/bipbop/gear4/prog_index.m3u8
<template><div><div id="dplayer"></div></div>
</template>
<script>// 引入dplayer和hlsimport DPlayer from 'dplayer';import Hls from 'hls.js'export default{data(){return(){dp: null}},created(){const dp = new DPlayer({container: document.getElementById('dplayer'),// live: true,video: {url: 'http://playertest.longtailvideo.com/adaptive/bipbop/gear4/prog_index.m3u8',type: 'customHls',customType: {customHls: function (video, player) {const hls = new Hls();hls.loadSource(video.src);hls.attachMedia(video);},},},});this.dp = dp;this.dp.play()}}
</script>

在这里插入图片描述

http://www.lryc.cn/news/120949.html

相关文章:

  • 给不蒜子(busuanzi)统计数据增加初始值
  • WebStorm
  • 代码随想录算法训练营day59
  • 大模型训练时间估算
  • 函数的模拟实现
  • CSDN博客批量查询质量分https://yma16.inscode.cc/请求超时问题(设置postman超时时间)(接口提供者设置了nginx超时时间)
  • 什么是 CSRF 攻击?
  • [内网渗透]CFS三层靶机渗透
  • 一百五十一、Kettle——Linux上安装的kettle8.2开启carte服务以及配置子服务器
  • 2023高教社杯数学建模A题 B题C题 D题 E题思路代码分析
  • 从ChatGLM2-6B来看大模型扩展上下文和加速推理相关技术
  • Unity特效总览
  • Unity中人物控制器
  • 零钱兑换-输出组合数
  • Mybatis 小结
  • 【Cartopy】库的安装和瓦片加载(天地图、高德等)
  • TCPDF生成PDF文件,含jpjraph生成雷达图
  • Flink-串讲面试题
  • 如何培养对技术的热爱
  • Vue响应式数据的原理
  • pytest fixture 用于teardown工作
  • 39 printf 的输出到设备层的调试
  • 数字普惠金融、数字创新与经济增长—基于省级面板数据的实证考察(2011-2021年)
  • 控制renderQueue解决NGUI与Unity3D物体渲染顺序问题
  • 概率论与数理统计:第二、三章:一维~n维随机变量及其分布
  • BOLT- 识别和优化热门的基本块
  • Golang 中的 time 包详解(四):函数详解
  • 【前端 | CSS】5种经典布局
  • 腾讯云宣布VPC网络架构重磅升级,可毫秒级感知网络故障并实现自愈
  • vue 路由页面跳转