|
112 | 112 | audio: 1, |
113 | 113 | // 声音id 0-不开启 1-开启 |
114 | 114 | autoplay: 1, |
| 115 | + videoLoading: false, |
115 | 116 | }, |
116 | 117 | state: { |
117 | 118 | countTimer: undefined, |
|
161 | 162 | autoplay: 1, |
162 | 163 | fullScreenStatus: 0, |
163 | 164 | bSupporDoubleClickFull: true, |
| 165 | + videoLoading: false, |
164 | 166 | }; |
165 | 167 | this.params = params; |
166 | 168 |
|
|
568 | 570 |
|
569 | 571 | hdDom.onclick = function () { |
570 | 572 | // 停止 |
571 | | - _this.stop(); |
572 | | - |
573 | | - if (_this.opt.url.indexOf('.hd') === -1) { |
574 | | - _this.opt.url = _this.opt.url.replace('.live', '.hd.live'); |
575 | | - hdDom.innerHTML = _this.opt.url.indexOf('.hd') === -1 ? '标清' : '高清'; |
576 | | - } else { |
577 | | - _this.opt.url = _this.opt.url.replace('.hd.live', '.live'); |
578 | | - } |
579 | | - |
580 | | - iframe.src = domain +"/ezopen/h5/iframe?url=" + _this.opt.url.replace('.hd.live', '.live') + "&autoplay=1&audio=" + _this.opt.audio + "&accessToken=" + _this.opt.accessToken + "&templete=" + 0; |
| 573 | + if(_this.opt.videoLoading){ |
| 574 | + layer.msg("视频加载中,请稍后"); |
| 575 | + return false; |
| 576 | + }else { |
| 577 | + var stopPromise = _this.stop(); |
| 578 | + _this.opt.videoLoading = true; |
| 579 | + stopPromise.then((data)=>{ |
| 580 | + _this.opt.videoLoading = false; |
| 581 | + if (_this.opt.url.indexOf('.hd') === -1) { |
| 582 | + _this.opt.url = _this.opt.url.replace('.live', '.hd.live'); |
| 583 | + hdDom.innerHTML = _this.opt.url.indexOf('.hd') === -1 ? '标清' : '高清'; |
| 584 | + } else { |
| 585 | + _this.opt.url = _this.opt.url.replace('.hd.live', '.live'); |
| 586 | + hdDom.innerHTML = _this.opt.url.indexOf('.hd') === -1 ? '标清' : '高清'; |
| 587 | + } |
| 588 | + _this.play(_this.opt.url) |
| 589 | + }) |
| 590 | + .catch((error)=>{ |
| 591 | + console.log("error",error) |
| 592 | + }) |
| 593 | + } |
| 594 | + //iframe.src = domain +"/ezopen/h5/iframe?url=" + _this.opt.url.replace('.hd.live', '.live') + "&autoplay=1&audio=" + _this.opt.audio + "&accessToken=" + _this.opt.accessToken + "&templete=" + 0; |
581 | 595 | }; |
582 | 596 |
|
583 | 597 | rightContros.appendChild(hdDom); |
|
1214 | 1228 | url: this.opt.url |
1215 | 1229 | }, domain + "/ezopen/h5/iframe"); |
1216 | 1230 | var _this = this; |
| 1231 | + this.opt.videoLoading = true; |
1217 | 1232 | var promise = new Promise(function(resolve,reject) { |
1218 | 1233 | window.addEventListener("message", function (event) { |
1219 | 1234 | var playId = _this.opt.id; |
1220 | 1235 | if (playId == event.data.id && event.data.type === 'handleSuccess') { |
| 1236 | + setTimeout(()=>{ |
| 1237 | + _this.opt.videoLoading = false; |
| 1238 | + },1000) |
1221 | 1239 | resolve(event.data); |
1222 | 1240 | } |
1223 | 1241 | }); |
|
0 commit comments