Commit 38f35110 by MichaelJier

feature

1. 横屏直播支持vr
parent e4c309d6
...@@ -56,6 +56,7 @@ export default { ...@@ -56,6 +56,7 @@ export default {
const info = JSON.parse(JSON.stringify(this.playerInfo)); const info = JSON.parse(JSON.stringify(this.playerInfo));
info.playUrl = url; info.playUrl = url;
info.cameraId = id; info.cameraId = id;
info.isVr = false;
this.set_playerInfo(info); this.set_playerInfo(info);
} }
} }
......
...@@ -67,6 +67,7 @@ export default { ...@@ -67,6 +67,7 @@ export default {
const info = JSON.parse(JSON.stringify(this.playerInfo)); const info = JSON.parse(JSON.stringify(this.playerInfo));
info.playUrl = url; info.playUrl = url;
info.cameraId = ''; info.cameraId = '';
info.isVr = false;
this.set_playerInfo(info); this.set_playerInfo(info);
}, },
_toggle() { _toggle() {
......
...@@ -131,7 +131,10 @@ export default { ...@@ -131,7 +131,10 @@ export default {
this.watermark(); this.watermark();
this.$nextTick(() => { this.$nextTick(() => {
const { playUrl } = this.playerUrl const { playUrl } = this.playerUrl
this._mpsPlayerInit(this.channelInfo.isVr, playUrl); this._mpsPlayerInit({
isVr: this.channelInfo.isVr,
url: playUrl
});
}); });
}, },
methods: { methods: {
...@@ -154,13 +157,13 @@ export default { ...@@ -154,13 +157,13 @@ export default {
watermark(`id: ${this.userInfo.id}`); watermark(`id: ${this.userInfo.id}`);
} }
}, },
_mpsPlayerInit(isVr, url) { _mpsPlayerInit({isVr, url, force}) {
const self = this; const self = this;
const changeControlShow = (flag) => { const changeControlShow = (flag) => {
// flag ? this.$Bus.$emit('ws-stop') : this.$Bus.$emit('ws-start') // flag ? this.$Bus.$emit('ws-stop') : this.$Bus.$emit('ws-start')
this.controlShow = flag this.controlShow = flag
} }
if (this.mpsPlayerObj) { if (this.mpsPlayerObj && !force) {
return false; return false;
} }
const playerOpts = { const playerOpts = {
...@@ -190,7 +193,9 @@ export default { ...@@ -190,7 +193,9 @@ export default {
}, },
...this.mpsOptions, ...this.mpsOptions,
onReady() { onReady() {
self._resetConfig(); if (url === self.playerUrl.playUrl) {
self._resetConfig();
}
// setTimeout(() => { // setTimeout(() => {
self.mpsPlayerObj.addPlayerCallback('Play.Stop', function(fn) { self.mpsPlayerObj.addPlayerCallback('Play.Stop', function(fn) {
fn({ type: 3 }); fn({ type: 3 });
...@@ -217,7 +222,7 @@ export default { ...@@ -217,7 +222,7 @@ export default {
playUrl: playUrl, playUrl: playUrl,
saveUrl: saveUrl, saveUrl: saveUrl,
cameraId: '', cameraId: '',
isVr: this.channelInfo.isVr isVr: !!this.channelInfo.isVr
}); });
}, },
_reviseProtocol(url) { _reviseProtocol(url) {
...@@ -249,9 +254,13 @@ export default { ...@@ -249,9 +254,13 @@ export default {
obj = this._reviseProtocol(this.playerInfo.playUrl); obj = this._reviseProtocol(this.playerInfo.playUrl);
} }
if (this.mpsPlayerObj) { if (this.mpsPlayerObj) {
if (nowIsVr != oldIsVr) { if (nowIsVr != oldIsVr && (nowIsVr !== undefined && oldIsVr !== undefined)) {
console.log(nowIsVr, oldIsVr, 'change player') console.log(nowIsVr, oldIsVr, 'change player')
this._mpsPlayerInit(nowIsVr, this.playerInfo.playUrl) this._mpsPlayerInit({
isVr: nowIsVr,
url: this.playerInfo.playUrl,
force: true
})
} else { } else {
console.log(nowIsVr, oldIsVr, 'no change player') console.log(nowIsVr, oldIsVr, 'no change player')
if (this.onePlayer && this.mpsPlayerObj.changePlayer) { if (this.onePlayer && this.mpsPlayerObj.changePlayer) {
...@@ -272,7 +281,6 @@ export default { ...@@ -272,7 +281,6 @@ export default {
watch: { watch: {
playerInfo: { playerInfo: {
handler(newVal, oldVal) { handler(newVal, oldVal) {
console.log(newVal, oldVal)
this._changePlayer(newVal.isVr, oldVal.isVr); this._changePlayer(newVal.isVr, oldVal.isVr);
}, },
deep: true deep: true
......
...@@ -45,6 +45,7 @@ export default { ...@@ -45,6 +45,7 @@ export default {
const info = JSON.parse(JSON.stringify(this.playerInfo)); const info = JSON.parse(JSON.stringify(this.playerInfo));
info.playUrl = info.saveUrl; info.playUrl = info.saveUrl;
info.cameraId = ''; info.cameraId = '';
info.isVr = false;
this.set_playerInfo(info); this.set_playerInfo(info);
}, },
_setBarrage() { _setBarrage() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment