From c50b638e265948e4cbfc86ec73e935cdf85088ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=9F=E8=BF=9B?= Date: Tue, 16 Jun 2020 13:27:06 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20infowindow-view.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/geo/ui/infowindow-view.js | 56 +++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/src/geo/ui/infowindow-view.js b/src/geo/ui/infowindow-view.js index c9526eb..5aba016 100644 --- a/src/geo/ui/infowindow-view.js +++ b/src/geo/ui/infowindow-view.js @@ -9,8 +9,6 @@ var util = require('../../core/util'); var ESC_KEY = 27; -var player; - /** * Usage: * var infowindow = new Infowindow({ @@ -96,7 +94,8 @@ var Infowindow = View.extend({ }, values); this.$el.html( - sanitize.html(this.template(obj), this.model.get('sanitizeTemplate')) +// sanitize.html(this.template(obj), this.model.get('sanitizeTemplate')) + sanitize.html(this.template(obj), false) ); // Set width and max-height from the model only @@ -119,6 +118,10 @@ var Infowindow = View.extend({ if (this._containsVideo()) { this._loadVideo(); } + + if (this._containsH5url()) { + this._loadH5url(); + } this._setupClasses(); this._renderScroll(); @@ -130,17 +133,31 @@ var Infowindow = View.extend({ }, // video add + _containsH5url: function () { + return !!this.$('.js-infowindow').attr('data-h5url'); + }, + + _loadH5url: function () { + var url = this._getCoverURL(); + + var $urlsrc = this.$('#mainContent'); + $urlsrc.attr('src', url); + + }, _containsVideo: function () { return !!this.$('.js-infowindow').attr('data-video'); }, _loadVideo: function () { - this._renderCoverLoader(); - this._startCoverLoader(); + //this._renderCoverLoader(); + //this._startCoverLoader(); var url = this._getCoverURL(); + var $urlsrc = this.$('#target'); + $urlsrc.attr('src', url); +/* if (this._isLoadingFields()) { return; } @@ -156,6 +173,10 @@ var Infowindow = View.extend({ } else { this._loadVideoFromUrl(url); } +*/ + var $urlsrc = this.$('#target'); + $urlsrc.attr('src', url); + }, _isValidVideoURL: function (url) { @@ -173,28 +194,14 @@ var Infowindow = View.extend({ }, _loadVideoFromUrl: function (url) { - var $cover = this.$('.js-cover'); - -// this._startCoverLoader(); - - var $v = $(''); - - var $video = $(''); + var $urlsrc = this.$('#target'); - //$cover.append($video); + //this._startCoverLoader(); - this._stopCoverLoader(); + $urlsrc.attr('src', url); player = videojs('hls-video'); -/* - $video - .load(this._onLoadVideoSuccess) - .error(this._onLoadVideoError) - .attr('src', url); -*/ }, _onLoadVideoError: function () { @@ -632,10 +639,7 @@ var Infowindow = View.extend({ this.model.set('visibility', false); } - if (player) { - player.pause(); - alert("videojs 暂停" ); - } + alert("videojs 暂停" ); }, /**