jessibuca官网:http://jessibuca.monibuca.com/player.html
git地址:https://gitee.com/huangz2350_admin/jessibuca#https://gitee.com/link?target=http%3A%2F%2Fjessibuca.monibuca.com%2F
项目需要的文件
1.播放组件
/* eslint-disable no-underscore-dangle */
export default {
name: 'Jessibuca',
props: {
index: {
//index
type: Number,
default: 0,
},
videoUrl: {
//播放地址
type: String,
default: '',
},
error: {
//报错信息
type: Function,
default: null,
},
hasAudio: {
//静音
type: Boolean,
default: false,
},
height: {
//播放器高度
type: String,
default: '500px',
},
isFullResize: {
//播放面即是否填充满容器
type: Boolean,
default: true,
},
autoplay: {
//是否自动播放
type: Boolean,
default: false,
},
background: {
//封面图
type: String,
default: '',
},
btnimage: {
//播放器按钮图片
type: String,
default: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAADUNJREFUeF7tnV+MHVUdx3/n3pVNbRFLDJhaNCG6pRAkWCUttrJYWtGAQXSlu3Nmob17Z7bFJVIUaQjtm4kv1KQktbcrone2JFYl8RlsrGLwwRhJ/MMfX4360IdiQuu6c8y5u9tdWpbemXPmN2fOfJv0bX6/3/l9fvPJ3Dn37owg/AMBEFiRgAAbEACBlQlAEJwdIPAeBCAITg8QgCA4B0AgHwFcQfJxQ1RNCECQmgwabeYjAEHycUNUTQhAkJoMGm3mIwBB8nFDVE0IQJCaDBpt5iMAQfJxQ1RNCECQmgwabeYjAEHycUNUTQhAkJoMGm3mIwBB8nFDVE0IsAkyNhZ/otlM19WEK9oskMDcXOMfJ04ce6PAEhdSFyZIEMTbhVD3CUE3KUWbiOgDHA2hRm0InBWC/qAU/VmIxgvd7g9+VUTnhQgiZfQ0ET1axIKREwRWIHA4STr7bdOxLoiU0WtENGR7ocgHAn0QeD1JOhv6OK7vQ6wKImV8mkht67s6DgQB+wROJ0nnDltprQkShnFLKTVta2HIAwJ5CSilWjMzx5/NG788zoogo6PxlmZT/c7GgpAD服务器托管网BGwQUCrdMjMz/Y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4PV40Z0oAgpgSRLzXBCCI1+NFc6YEIIgpQcR7TQCCeD1eNGdKAIKYEkS81wQgiNfjRXOmBCCIKUHEe00Agng9XjRnSgCCmBJEvNcEIIjX40VzpgQgiClBxHtNAIJ4PV40Z0oAgpgSRLzXBJwQZHy8PZSmwvjNr15PCs2VQiBNxdCJE8feMCkuTIIXY6WMzhLRlTZyIQcIWCJwNkk6V5nmsiRI+xSRGDZdDOJBwBYBIehUt9v5vGk+K4IEQfSMEPSw6WIQDwIWCTyTJJ0p03yWBIm3C6FeNF0M4kHAFgGlxF0zM8deMs1nRRC9CCkj/e7wR00XhHgQsEDgcJJ09lvIQ9YEWZBE72YN2VgYcoBATgKvJ0lnQ87YS8KsCjIvSXyaSG2ztUDkAYEMBE4nSeeODMdf9lDrguiKYRi3lFLTl62OA0DAEgEh0olud/qHltJdSFOIIDr76Gi8pdFIx4UQnyQi/X+N7cUjX60J/IeIXiWiPymV/mRmZvqVImgUJsjFiw3DiY1K0bVFNIGc9SIgBP2r253+K0fXbIJwNIMaIGCbAASxTRT5vCIAQbwaJ5qxTQCC2CaKfF4RgCBejRPN2CYAQWwTRT6vCEAQr8aJZmwTgCC2iSKfVwQgiFfjRDO2CUAQ20SRzysCEMSrcaIZ2wQgiG2iyOcVAQji1TjRjG0CEMQ2UeTzigAE8WqcaMY2AQhimyjyeUXg/3DQ3hQovnZyAAAAAElFTkSuQmCC',
},
btnimageH: {
//播放器按钮图片高度
type: String,
default: '60px',
},
btnimageW: {
//播放器按钮图片宽度
type: String,
default: '60px',
},
},
data() {
return {
jessibuca: null,
playing: false,
isNotMute: false,
quieting: false,
fullscreen: false,
loaded: false, // mute
speed: 0,
performance: '', // 工作情况
kBps: 0,
btnDom: null,
videoInfo: null,
volume: 1,
rotate: 0,
vod: true, // 点播
forceNoOffscreen: false,
}
},
watch: {
videoUrl: {
handler(newData, oldData) {
if (!this.autoplay && !oldData) return
this.play(newData)
},
},
},
mounted() {
window.onerror = (msg) => {
// console.error(msg)
}
const paramUrl = decodeURIComponent(this.$route.params.url)
this.$nextTick(() => {
if (typeof this.videoUrl === 'undefined') {
this.videoUrl = paramUrl
}
this.btnDom = document.getElementById('buttonsBox' + this.index)
console.log(`初始化时的地址为: ${this.videoUrl}`)
this.autoplay ? this.play(this.videoUrl) : ''
})
},
destroyed() {
if (this.jessibuca) {
this.jessibuca.destroy()
}
this.playing = false
// this.loaded = false
this.performance = ''
},
methods: {
create() {
const options = {}
console.log(this.$refs.container)
console.log(`hasAudio ${this.hasAudio}`)
this.jessibuca = new window.Jessibuca(
Object.assign(
{
container: this.$refs.container,
videoBuffer: 0.5, // 最大缓冲时长,单位秒
isResize: true,
isFlv: true,
decoder: '/js/jessibuca/index.js',
// text: "WVP-PRO",
// background: "bg.jpg",
loadingText: '加载中',
hasAudio:
typeof this.hasAudio === 'undefined' ? true : this.hasAudio,
debug: false,
supportDblclickFullscreen: false, // 是否支持屏幕的双击事件,触发全屏,取消全屏事件。
operateBtns: {
fullscreen: false,
screenshot: false,
play: false,
audio: false,
},
record: 'record',
isFullResize: this.isFullResize || false,
vod: this.vod,
forceNoOffscreen: this.forceNoOffscreen,
isNotMute: this.isNotMute,
},
options
)
)
// eslint-disable-next-line no-underscore-dangle
const _this = this
this.jessibuca.on('load', () => {
console.log('on load init')
})
this.jessibuca.on('log', (msg) => {
console.log('on log', msg)
})
this.jessibuca.on('record', (msg) => {
console.log('on record:', msg)
})
this.jessibuca.on('pause', () => {
_this.playing = false
})
this.jessibuca.on('play', () => {
_this.playing = true
})
this.jessibuca.on('fullscreen', (msg) => {
console.log('on fullscreen', msg)
_this.fullscreen = msg
})
this.jessibuca.on('mute', (msg) => {
console.log('on mute', msg)
_this.isNotMute = !msg
})
this.jessibuca.on('audioInfo', (msg) => {
// console.log("audioInfo", msg);
})
this.jessibuca.on('videoInfo', function (msg) {
this.videoInfo = msg
// console.log("videoInfo", msg);
})
this.jessibuca.on('bps', (bps) => {
// console.log('bps', bps);
})
// eslint-disable-next-line no-unused-vars
let _ts = 0
this.jessibuca.on('timeUpdate', (ts) => {
// console.log('timeUpdate,old,new,timestamp', _ts, ts, ts - _ts);
_ts = ts
})
this.jessibuca.on('videoInfo', (info) => {
console.log('videoInfo', info)
})
this.jessibuca.on('error', (error) => {
console.log('error', error)
})
this.jessibuca.on('timeout', () => {
console.log('timeout')
})
this.jessibuca.on('start', () => {
console.log('start')
})
this.jessibuca.on('performance', (performance) => {
let show = '卡顿'
if (performance === 2) {
show = '非常流畅'
} else if (performance === 1) {
show = '流畅'
}
_this.performance = show
})
this.jessibuca.on('buffer', (buffer) => {
// console.log('buffer', buffer);
})
this.jessibuca.on('stats', (stats) => {
// console.log('stats', stats);
})
this.jessibuca.on('kBps', (kBps) => {
_this.kBps = Math.round(kBps)
})
// 显示时间戳 PTS
this.jessibuca.on('videoFrame', () => { })
//
this.jessibuca.on('metadata', () => { })
},
playBtnClick(event) {
this.play(this.videoUrl)
},
play(url) {
if (!url || url.length == 0) {
this.$message.warning('当前摄像头出错,请稍后重试')
this.pause()
return
}
服务器托管网 if (this.jessibuca) {
this.destroy()
}
this.create()
this.jessibuca.on('play', () => {
this.playing = true
// this.loaded = true
// this.quieting = this.jessibuca.quieting
})
if (this.jessibuca.hasLoaded()) {
this.jessibuca.play(url)
} else {
this.jessibuca.on('load', () => {
console.log('load 播放')
this.jessibuca.play(url)
})
}
},
pause() {
if (this.jessibuca) {
this.jessibuca.pause()
}
this.playing = false
this.err = ''
this.performance = ''
},
destroy() {
if (this.jessibuca) {
this.jessibuca.destroy()
}
if (document.getElementById('buttonsBox' + this.index) == null) {
document
.getElementById('container' + this.index)
.appendChild(this.btnDom)
}
this.jessibuca = null
this.playing = false
this.err = ''
this.performance = ''
},
showbtn() {
if (document.getElementById('buttonsBox' + this.index) == null) {
document
.getElementById('container' + this.index)
.appendChild(this.btnDom)
}
},
eventcallbacK(type, message) {
// console.log("player 事件回调")
// console.log(type)
// console.log(message)
},
fullscreenSwich() {
const isFull = this.isFullscreen()
this.jessibuca.setFullscreen(!isFull)
this.fullscreen = !isFull
},
isFullscreen() {
return (
document.fullscreenElement ||
document.msFullscreenElement ||
document.mozFullScreenElement ||
document.webkitFullscreenElement ||
false
)
},
},
}
@font-face {
font-family: 'iconfont';
/* Project id 1291092 */
src: url('iconfont.woff2') format('woff2');
}
.iconfont {
font-family: 'iconfont' !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-play:before {
content: 'e603';
}
.icon-pause:before {
content: 'e6c6';
}
.icon-stop:before {
content: 'e6a8';
}
.icon-audio-high:before {
content: 'e793';
}
.icon-audio-mute:before {
content: 'e792';
}
.icon-shuaxin11:before {
content: 'e720';
}
.icon-weibiaoti10:before {
content: 'e78f';
}
.icon-weibiaoti11:before {
content: 'e790';
}
.icon-camera1196054easyiconnet:before {
content: 'e791';
}
.buttons-box {
width: 100%;
height: 0px;
transition: 0.4s;
background-color: rgba(43, 51, 63, 0.7);
display: -webkit-box;
display: -ms-flexbox;
display: flex;
user-select: none;
z-index: 100;
display: flex;
align-items: center;
overflow: hidden;
}
#jessibuca:hover .buttons-box {
height: 40px;
}
.buttons-box-left {
display: flex;
flex: 1;
align-items: center;
}
.jessibuca-btn {
color: rgb(255, 255, 255);
line-height: 27px;
margin: 0px 5px;
padding: 0px 2px;
cursor: pointer;
text-align: center;
font-size: 20px !important;
}
.buttons-box-right {
height: 100%;
position: absolute;
right: 0;
display: flex;
flex: 1;
align-items: center;
font-size: 20px;
}
.btn-image {
width: 100%;
/* height: 100%; */
position: absolute;
left: 0;
top: 0;
z-index: 99 !important;
}
.btn-image-center {
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
margin: auto;
}
.jessibuca-btn 设置播放控件的间距
decoder: '/js/jessibuca/index.js',地址是服务静态文件的相对地址
src: url('iconfont.woff2') format('woff2'); 相对地址 iconfont.woff2需要和组件放在同一目录下
2.父组件引用
import player from '@/components/jessibuca/index.vue' // h265播放器
export default {
name: 'video',
components: {
player,
},
data() {
return {
}
},
computed: {
// 获取时间戳
getIndex() {
let time = new Date().getTime()
return time
},
},
}
3.index.html 需要引入静态js文件
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
相关推荐: 【机器学习】数据清洗——基于Pandas库的方法删除重复点
个人主页:豌豆射手^ 欢迎 点赞✍评论⭐收藏 收录专栏:机器学习 希望本文对您有所裨益,如有不足之处,欢迎在评论区提出指正,让我们共同学习、交流进步! 【机器学习】数据清洗 ——基于Pandas库的方法删除重复点 一 drop_duplicates() 介绍 …