Commit 6b7f5c2c by Tianqing Liu

feat: optimization

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