vue-video-player集成videojs-contrib-hls实现.m3u8文件播放
// 安装依赖
npm install vue-video-player --save
npm install videojs-contrib-hls --save // 在main.js中全局引入
import VideoPlayer from 'vue-video-player';
import 'video.js/dist/video-js.css';
import 'vue-video-player/src/custom-theme.css';
import videojs from 'video.js';
window.videojs = videojs;
require('videojs-contrib-hls/dist/videojs-contrib-hls.js'); Vue.use(VideoPlayer); //组件中使用
<template>
<md-card>
<md-card-actions>
<div class="md-subhead">
<span>HLS Live / 直播</span>
</div>
<md-button class="md-icon-button"
target="_blank"
href="https://github.com/surmon-china/vue-video-player/tree/master/examples/04-video.vue">
<md-icon>code</md-icon>
</md-button>
</md-card-actions>
<md-card-media>
<div class="item">
<div class="player">
<video-player class="vjs-custom-skin"
:options="playerOptions"
@ready="playerReadied">
</video-player>
</div>
</div>
</md-card-media>
</md-card>
</template> <script>
export default {
data() {
return {
playerOptions: {
// videojs and plugin options
height: '360',
sources: [{
withCredentials: false,
type: "application/x-mpegURL",
src: "path-to/playlist.m3u8"
}],
controlBar: {
timeDivider: false,
durationDisplay: false
},
flash: { hls: { withCredentials: false }},
html5: { hls: { withCredentials: false }},
poster: "path-to/static/images/surmon-5.jpg"
}
}
},
methods: {
playerReadied(player) {
var hls = player.tech({ IWillNotUseThisInPlugins: true }).hls
player.tech_.hls.xhr.beforeRequest = function(options) {
// console.log(options)
return options
}
}
}
}
</script>
vue-video-player集成videojs-contrib-hls实现.m3u8文件播放的更多相关文章
- HLS的M3U8文件介绍
HLS的M3U8文件介绍 HLS (HTTP Live Streaming)是Apple的动态码率自适应技术.主要用于PC和Apple终端的音视频服务. 相较于实时传输协议(RTP),HLS可以穿过任 ...
- Embed MP4 in HTML using flash-player(html5 video player)
https://stackoverflow.com/questions/1000851/embed-mp4-in-html-using-flash-player ******************* ...
- HTML5 stream video player
HTML5 stream video player Aliplayer https://player.alicdn.com/aliplayer/index.html https://help.aliy ...
- HTML5 Video player jQuery plugin
<!DOCTYPE html> <html lang="en" > <head> <meta charset="utf-8&qu ...
- vue与TypeScript集成配置最简教程
https://blog.csdn.net/u014633852/article/details/73706459 https://segmentfault.com/a/119000001187808 ...
- Free Video Player All In One
Free Video Player All In One VLC media player https://github.com/videolan/vlc VideoLAN https://www.v ...
- 关于大视频video播放的问题以及解决方案(m3u8的播放)
在HTML5里,提供了<video>标签,可以直接播放视频,video的使用很简单: <video width="320" height="240&qu ...
- HLS(HTTP Live Streaming)协议之m3u8文件生成方式
HLS(HTTP Live Streaming)是Apple的动态码率自适应技术.主要用于PC和Apple终端的音视频服务.包括一个m3u(8)的索引文件,TS媒体分片文件和key加密串文件. HLS ...
- 如何生成HLS协议的M3U8文件
什么是HLS协议: HLS(Http Live Streaming)是由Apple公司定义的用于实时流传输的协议,HLS基于HTTP协议实现,传输内容包括两部分,一是M3U8描述文件,二是TS媒体文件 ...
随机推荐
- codeforces660C
Hard Process CodeForces - 660C You are given an array a with n elements. Each element of a is either ...
- FileZilla-01
FileZilla FTP-client可用于通过上传和下载文件和图像来管理WordPress网站. 设置选项: 01.网址:ftp地址(如果网址是http://example.com,则通常是ftp ...
- Django 框架基础
Python web框架 本质 收发socket消息 --> 按照HTTP协议消息格式去解析消息 路径和要执行的函数的对应关系 --> 主要的业务逻辑 字符串替换 --> 模板(特殊 ...
- 【JVM】类加载机制
原文:[深入Java虚拟机]之四:类加载机制 类从被加载到虚拟机内存中开始,到卸载出内存为止,它的整个生命周期包括:加载.验证.准备.解析.初始化.使用和卸载七个阶段.它们开始的顺序如下图所示: 类加 ...
- purge旧的ubuntu 的linux内核
https://www.sysgeek.cn/remove-old-kernels-ubuntu-16-04/
- Pandas系列(一)-Series详解
一.初始Series Series 是一个带有 名称 和索引的一维数组,既然是数组,肯定要说到的就是数组中的元素类型,在 Series 中包含的数据类型可以是整数.浮点.字符串.Python对象等. ...
- JavaScript 基础六 'use strict'严格模式下的规则
why 严格模式 [1] 消除js语法的一些不合理.不严谨.不安全问题,减少怪异行为并保证代码运行安全 [2] 提高编译器效率,增加运行速度 使用 [1]整个脚本启用严格模式,在顶部执行:" ...
- HTML(三)HTML属性
HTML 属性 属性: [class] 规定元素的一个或多个类 注意: 类不能以数字开头 class = "classA classB" // 多个类的写法 [id] 规定元素的唯 ...
- c#管理文件系统
using System; using System.Collections.Generic; using System.IO; using static System.Console; /*Syst ...
- LeakCanary监测内存泄漏的原理
监测机制利用了Java的WeakReference和ReferenceQueue,通过将Activity包装到WeakReference中,被WeakReference包装过的Activity对象如果 ...