
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
vue-hls-player
Advanced tools
hls vue播放器,支持video和audio。
npm install vue-hls-player
//入口index.js
import player from 'vue-hls-player'
Vue.use(player)
//test.vue
<vplayer :playerOptions = "vOption" @onplay="play" />
vOption:{
type: "application/x-mpegURL",//媒体类型,m3u8请给application/x-mpegURL或者application/vnd.apple.mpegURL,其他的会默认为普通音视频,注:微信不支持m3u8
src: 'http://ph1vqefl0.bkt.clouddn.com/hlsnature2',//视频地址
preload: true,//是否预下载,默认为true
autoplay: true,//是否自动播放(兼容性不太好),默认为false
isLoop: false,//是否循环,默认不循环
playsinline: false, //h5是否行内播放,默认false,有兼容性问题
poster: 'https://oimdztrab.qnssl.com/Frp4SyVe5PosdkUKRaE-krjK7B5z', //封面,仅视频有
controls: 'progress,current,durration,volume' //显示的控件,volume只有视频有,没有配置controls项则全部显示。
crossOrigin: false //设置视频的 CORS 设置。
}
methods:{
play(e){
console.log(e)
}
}
import { aplayer } from 'vue-hls-player'
components: { aplayer }
<aplayer :playerOptions = "aOption" @onpause="pause" />
aOption:{
type: "application/x-mpegURL", //媒体类型,m3u8请给application/x-mpegURL或者application/vnd.apple.mpegURL,其他的会默认为普通音视频,注:微信不支持m3u8
src: 'http://ph1vqefl0.bkt.clouddn.com/hlsnature2', //音频地址
preload: true, //是否预下载,默认为true
autoplay: true, //是否自动播放(兼容性不太好),默认为false
isLoop: false, //是否循环,默认不循环
controls: 'progress,current,durration', //显示的控件,没有配置controls项则全部显示。
}
methods:{
pause(e){
console.log(e)
}
}
import { vplayer } from 'vue-hls-player'
components: { vplayer }
<vplayer :playerOptions = "vOption" @onpause="pause" />
vOption:{
type: "application/x-mpegURL",//媒体类型,m3u8请给application/x-mpegURL或者application/vnd.apple.mpegURL,其他的会默认为普通音视频,注:微信不支持m3u8
src: 'http://ph1vqefl0.bkt.clouddn.com/hlsnature2',//视频地址
preload: true,//是否预下载,默认为true
autoplay: true,//是否自动播放(兼容性不太好),默认为false
isLoop: false,//是否循环,默认不循环
poster: 'https://oimdztrab.qnssl.com/Frp4SyVe5PosdkUKRaE-krjK7B5z', //封面,仅视频有
controls: 'progress,current,durration,volume', //显示的控件,volume只有视频有,没有配置controls项则全部显示。progress:进度条;current:已播放时长;durration:音视频长度;volume:音量
crossOrigin: false //设置视频的 CORS 设置。
}
methods:{
pause(e){
console.log(e)
}
}
FAQs
vue hls player,audio,video
We found that vue-hls-player demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.