Commit 6b7f5c2c by Tianqing Liu

feat: optimization

1 parent 2162ae08
...@@ -38,9 +38,6 @@ export default { ...@@ -38,9 +38,6 @@ export default {
return { return {
// eslint-disable-next-line // eslint-disable-next-line
_jessibuca: null, _jessibuca: null,
// TODO: 播放状态应从播放器对象获取
playing: false,
isPlayed: false,
playOriginUrl: '', playOriginUrl: '',
player: { player: {
...@@ -122,14 +119,14 @@ export default { ...@@ -122,14 +119,14 @@ export default {
this.player.height = data.height; this.player.height = data.height;
}); });
playerIns.on('play', (flag) => { /* playerIns.on('play', (flag) => {
console.log('on-play', flag); console.log('on-play', flag);
this.playing = true; this.playing = true;
}); });
playerIns.on('pause', (flag) => { playerIns.on('pause', (flag) => {
console.log('on-pause', flag); console.log('on-pause', flag);
this.playing = false; this.playing = false;
}); }); */
playerIns.on('ptz', (arrow) => { playerIns.on('ptz', (arrow) => {
// console.log('ptz', arrow); // console.log('ptz', arrow);
...@@ -166,7 +163,6 @@ export default { ...@@ -166,7 +163,6 @@ export default {
if (this._jessibuca) { if (this._jessibuca) {
this._jessibuca.destroy().then(() => { this._jessibuca.destroy().then(() => {
this._jessibuca = null; this._jessibuca = null;
this.playing = false;
}).catch(() => { }).catch(() => {
Promise.reject(new Error('destruction failed')); Promise.reject(new Error('destruction failed'));
}); });
...@@ -177,7 +173,9 @@ export default { ...@@ -177,7 +173,9 @@ export default {
screenshot(filename = '', format = 'png', quality = 0.92, type = 'base64') { screenshot(filename = '', format = 'png', quality = 0.92, type = 'base64') {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// 如果是播放状态 // 如果是播放状态
if (!this.player.height || !this.player.width || !this.playing) { const isPlaying = this._jessibuca.isPlaying();
console.log('screenshot', isPlaying);
if (!this.player.height || !this.player.width || !isPlaying) {
reject(new Error('invaild data')); reject(new Error('invaild data'));
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!