
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
vue-videojs7
Advanced tools
A vue video.js7 plugin, so you can play hls video(m3u8 format) within html5 easily, original forked from : https://github.com/surmon-china/vue-video-player
Demo for Video.js 7 m3u8 player
yarn add vue-videojs7
npm install vue-videojs7 --save
import Vue from 'vue'
import {VideoPlayer} from 'vue-videojs7'
Vue.use(VideoPlayer, /* {
options: global default videojs options,
events: global videojs videojs events
} */)
import {videoPlayer} from 'vue-videojs7'
export default {
components: {
videoPlayer
}
}
~/plugins/vue-videojs7.js
, put below code:import Vue from 'vue'
import VideoPlayer from 'vue-videojs7'
Vue.use(VideoPlayer, /* {
options: global default videojs options,
events: global videojs videojs events
} */)
nuxt.config.js
file: plugins: [
{src: '~/plugins/vue-videojs7.js', mode: 'client'}
]
<video-player ref="videoPlayer"
class="vjs-custom-skin"
:options="playerOptions"
@play="onPlayerPlay($event)"
@ready="onPlayerReady($event)">
</video-player>
For detail configuration in nuxt project, check the example nuxt code
Detail full copied example from Home.vue
<template>
<div class="player">
<h3>Using Html5 to play m3u8 media file</h3>
<video-player ref="videoPlayer"
class="vjs-custom-skin"
:options="playerOptions"
@play="onPlayerPlay($event)"
@ready="onPlayerReady($event)">
</video-player>
</div>
</template>
<script>
import VideoPlayer from '@/components/VideoPlayer.vue'
export default {
name: 'home',
components: {
VideoPlayer
},
data () {
return {
playerOptions: {
autoplay: true,
controls: true,
controlBar: {
timeDivider: false,
durationDisplay: false
}
// poster: 'https://surmon-china.github.io/vue-quill-editor/static/images/surmon-5.jpg'
}
}
},
computed: {
player () {
return this.$refs.videoPlayer.player
}
},
methods: {
onPlayerPlay (player) {
console.log('player play!', player)
},
onPlayerReady (player) {
console.log('player ready!', player)
this.player.play()
},
playVideo: function (source) {
const video = {
withCredentials: false,
type: 'application/x-mpegurl',
src: source
}
this.player.reset() // in IE11 (mode IE10) direct usage of src() when <src> is already set, generated errors,
this.player.src(video)
// this.player.load()
this.player.play()
}
},
mounted () {
const src = 'https://bitdash-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8'
this.playVideo(src)
}
}
</script>
<style scoped>
.player {
position: absolute !important;
width: 100%;
height: 60%;
}
.vjs-custom-skin {
height: 60% !important;
}
.vjs-custom-skin /deep/ .video-js {
height: 60%;
}
</style>
Email: alterhu2020@gmail.com
FAQs
A vue video player plugin using video.js 7.
The npm package vue-videojs7 receives a total of 412 weekly downloads. As such, vue-videojs7 popularity was classified as not popular.
We found that vue-videojs7 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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.