* @function VideoMapLayer.prototype.add * @description 添加视频图层。 * @param {string} address - 视频地址。
(address)
| 28 | * @param {string} address - 视频地址。 |
| 29 | */ |
| 30 | add(address) { |
| 31 | this.address = address; |
| 32 | if (!this.address) { |
| 33 | return; |
| 34 | } |
| 35 | this.renderer = new VideoLayerRenderer({ url: this.address, id: this.id, loop: this.loop, autoplay: this.autoplay }); |
| 36 | this.video = this.renderer.createVideo(); |
| 37 | this.videoDomId = this.renderer.getVideoDomId(); |
| 38 | this.video.one('firstplay', () => { |
| 39 | if (this.autoplay) { |
| 40 | this.play(); |
| 41 | } |
| 42 | }); |
| 43 | this.video.one('canplay', () => { |
| 44 | this.videoWidth = this.video.videoWidth(); |
| 45 | this.videoHeight = this.video.videoHeight(); |
| 46 | this._addVideoLayer(this.map); |
| 47 | }); |
| 48 | } |
| 49 | |
| 50 | _createVideoElement() { |
| 51 | let video = document.createElement('video'); |
nothing calls this directly
no test coverage detected