mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-26 15:07:49 +08:00
优化播放效果
This commit is contained in:
parent
0ed37d58ec
commit
3009951e45
@ -295,6 +295,7 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.videoUrl = streamInfo['ws_flv']
|
this.videoUrl = streamInfo['ws_flv']
|
||||||
}
|
}
|
||||||
|
console.log(location.protocol)
|
||||||
this.streamInfo = streamInfo
|
this.streamInfo = streamInfo
|
||||||
this.timeLen = timeLen
|
this.timeLen = timeLen
|
||||||
this.startTime = startTime
|
this.startTime = startTime
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
@dblclick="fullscreenSwich"
|
@dblclick="fullscreenSwich"
|
||||||
>
|
>
|
||||||
<div style="width:100%; padding-top: 56.25%; position: relative;" />
|
<div style="width:100%; padding-top: 56.25%; position: relative;" />
|
||||||
<div id="buttonsBox" class="buttons-box" v-if="typeof showButton == 'undefined' || showButton">
|
<div id="buttonsBox" class="buttons-box" >
|
||||||
<div class="buttons-box-left">
|
<div class="buttons-box-left">
|
||||||
<i v-if="!playing" class="iconfont icon-play jessibuca-btn" @click="playBtnClick" />
|
<i v-if="!playing" class="iconfont icon-play jessibuca-btn" @click="playBtnClick" />
|
||||||
<i v-if="playing" class="iconfont icon-pause jessibuca-btn" @click="pause" />
|
<i v-if="playing" class="iconfont icon-pause jessibuca-btn" @click="pause" />
|
||||||
@ -57,9 +57,12 @@ export default {
|
|||||||
watch: {
|
watch: {
|
||||||
videoUrl: {
|
videoUrl: {
|
||||||
handler(val, _) {
|
handler(val, _) {
|
||||||
this.$nextTick(() => {
|
if (val) {
|
||||||
this.play(val)
|
this.$nextTick(() => {
|
||||||
})
|
console.log(22222111)
|
||||||
|
this.play(val)
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
immediate: true
|
immediate: true
|
||||||
}
|
}
|
||||||
@ -67,7 +70,7 @@ export default {
|
|||||||
created() {
|
created() {
|
||||||
const paramUrl = decodeURIComponent(this.$route.params.url)
|
const paramUrl = decodeURIComponent(this.$route.params.url)
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if (typeof (this.videoUrl) === 'undefined') {
|
if (typeof (this.videoUrl) === 'undefined' || typeof (paramUrl) !== 'undefined') {
|
||||||
this.videoUrl = paramUrl
|
this.videoUrl = paramUrl
|
||||||
}
|
}
|
||||||
this.btnDom = document.getElementById('buttonsBox')
|
this.btnDom = document.getElementById('buttonsBox')
|
||||||
@ -89,16 +92,21 @@ export default {
|
|||||||
if (jessibucaPlayer[this._uid]) {
|
if (jessibucaPlayer[this._uid]) {
|
||||||
jessibucaPlayer[this._uid].destroy()
|
jessibucaPlayer[this._uid].destroy()
|
||||||
}
|
}
|
||||||
this.$refs.container.dataset['jessibuca'] = undefined
|
console.log(1111)
|
||||||
|
console.log(this.$refs.container.dataset['jessibuca'])
|
||||||
|
if (this.$refs.container.dataset['jessibuca']) {
|
||||||
|
this.$refs.container.dataset['jessibuca'] = undefined
|
||||||
|
}
|
||||||
|
|
||||||
if (this.$refs.container.getAttribute('data-jessibuca')) {
|
if (this.$refs.container.getAttribute('data-jessibuca')) {
|
||||||
this.$refs.container.removeAttribute('data-jessibuca')
|
this.$refs.container.removeAttribute('data-jessibuca')
|
||||||
}
|
}
|
||||||
const options = {
|
const options = {
|
||||||
container: this.$refs.container,
|
container: this.$refs.container,
|
||||||
videoBuffer: 0,
|
videoBuffer: 0,
|
||||||
isResize: false,
|
isResize: true,
|
||||||
useMSE: true,
|
useMSE: true,
|
||||||
useWCS: true,
|
useWCS: false,
|
||||||
text: '',
|
text: '',
|
||||||
// background: '',
|
// background: '',
|
||||||
controlAutoHide: false,
|
controlAutoHide: false,
|
||||||
@ -193,7 +201,6 @@ export default {
|
|||||||
console.log('Jessibuca -> playToRenderTimes: ', msg)
|
console.log('Jessibuca -> playToRenderTimes: ', msg)
|
||||||
})
|
})
|
||||||
jessibuca.on('timeUpdate', (videoPTS) => {
|
jessibuca.on('timeUpdate', (videoPTS) => {
|
||||||
console.log(videoPTS)
|
|
||||||
if (jessibuca.videoPTS) {
|
if (jessibuca.videoPTS) {
|
||||||
this.playerTime += (videoPTS - jessibuca.videoPTS)
|
this.playerTime += (videoPTS - jessibuca.videoPTS)
|
||||||
this.$emit('playTimeChange', this.playerTime)
|
this.$emit('playTimeChange', this.playerTime)
|
||||||
@ -210,18 +217,21 @@ export default {
|
|||||||
this.destroy()
|
this.destroy()
|
||||||
}
|
}
|
||||||
this.create()
|
this.create()
|
||||||
jessibucaPlayer[this._uid].on('play', () => {
|
this.$nextTick(() => {
|
||||||
this.playing = true
|
jessibucaPlayer[this._uid].on('play', () => {
|
||||||
this.loaded = true
|
this.playing = true
|
||||||
this.quieting = jessibuca.quieting
|
this.loaded = true
|
||||||
})
|
this.quieting = jessibuca.quieting
|
||||||
if (jessibucaPlayer[this._uid].hasLoaded()) {
|
|
||||||
jessibucaPlayer[this._uid].play(url)
|
|
||||||
} else {
|
|
||||||
jessibucaPlayer[this._uid].on('load', () => {
|
|
||||||
jessibucaPlayer[this._uid].play(url)
|
|
||||||
})
|
})
|
||||||
}
|
if (jessibucaPlayer[this._uid].hasLoaded()) {
|
||||||
|
jessibucaPlayer[this._uid].play(url)
|
||||||
|
} else {
|
||||||
|
jessibucaPlayer[this._uid].on('load', () => {
|
||||||
|
jessibucaPlayer[this._uid].play(url)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
pause: function() {
|
pause: function() {
|
||||||
if (jessibucaPlayer[this._uid]) {
|
if (jessibucaPlayer[this._uid]) {
|
||||||
|
|||||||
@ -21,20 +21,19 @@
|
|||||||
@tab-click="changePlayer"
|
@tab-click="changePlayer"
|
||||||
>
|
>
|
||||||
<el-tab-pane label="Jessibuca" name="jessibuca">
|
<el-tab-pane label="Jessibuca" name="jessibuca">
|
||||||
<div style="height: 22.5vw">
|
<jessibucaPlayer
|
||||||
<jessibucaPlayer
|
style="height: 22.5vw"
|
||||||
v-if="activePlayer === 'jessibuca'"
|
v-if="activePlayer === 'jessibuca'"
|
||||||
ref="jessibuca"
|
ref="jessibuca"
|
||||||
:visible.sync="showVideoDialog"
|
:visible.sync="showVideoDialog"
|
||||||
:video-url="videoUrl"
|
:video-url="videoUrl"
|
||||||
:error="videoError"
|
:error="videoError"
|
||||||
:message="videoError"
|
:message="videoError"
|
||||||
:has-audio="hasAudio"
|
:has-audio="hasAudio"
|
||||||
fluent
|
fluent
|
||||||
autoplay
|
autoplay
|
||||||
live
|
live
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
|
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="WebRTC" name="webRTC">
|
<el-tab-pane label="WebRTC" name="webRTC">
|
||||||
@ -351,7 +350,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
video: 'http://lndxyj.iqilu.com/public/upload/2019/10/14/8c001ea0c09cdc59a57829dabc8010fa.mp4',
|
video: 'http://lndxyj.iqilu.com/public/upload/2019/10/14/8c001ea0c09cdc59a57829dabc8010fa.mp4',
|
||||||
videoUrl: '',
|
videoUrl: null,
|
||||||
activePlayer: 'jessibuca',
|
activePlayer: 'jessibuca',
|
||||||
// 如何你只是用一种播放器,直接注释掉不用的部分即可
|
// 如何你只是用一种播放器,直接注释掉不用的部分即可
|
||||||
player: {
|
player: {
|
||||||
@ -427,7 +426,6 @@ export default {
|
|||||||
console.log(this.player[tab.name][0])
|
console.log(this.player[tab.name][0])
|
||||||
this.activePlayer = tab.name
|
this.activePlayer = tab.name
|
||||||
this.videoUrl = this.getUrlByStreamInfo()
|
this.videoUrl = this.getUrlByStreamInfo()
|
||||||
console.log(this.videoUrl)
|
|
||||||
},
|
},
|
||||||
openDialog: function(tab, deviceId, channelId, param) {
|
openDialog: function(tab, deviceId, channelId, param) {
|
||||||
if (this.showVideoDialog) {
|
if (this.showVideoDialog) {
|
||||||
@ -439,7 +437,7 @@ export default {
|
|||||||
this.streamId = ''
|
this.streamId = ''
|
||||||
this.mediaServerId = ''
|
this.mediaServerId = ''
|
||||||
this.app = ''
|
this.app = ''
|
||||||
this.videoUrl = ''
|
this.videoUrl = null
|
||||||
if (this.$refs[this.activePlayer]) {
|
if (this.$refs[this.activePlayer]) {
|
||||||
this.$refs[this.activePlayer].pause()
|
this.$refs[this.activePlayer].pause()
|
||||||
}
|
}
|
||||||
@ -470,7 +468,6 @@ export default {
|
|||||||
this.playFromStreamInfo(false, streamInfo)
|
this.playFromStreamInfo(false, streamInfo)
|
||||||
},
|
},
|
||||||
getUrlByStreamInfo() {
|
getUrlByStreamInfo() {
|
||||||
console.log(this.streamInfo)
|
|
||||||
let streamInfo = this.streamInfo
|
let streamInfo = this.streamInfo
|
||||||
if (this.streamInfo.transcodeStream) {
|
if (this.streamInfo.transcodeStream) {
|
||||||
streamInfo = this.streamInfo.transcodeStream
|
streamInfo = this.streamInfo.transcodeStream
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user