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'); + var $urlsrc = this.$('#target'); -// this._startCoverLoader(); + //this._startCoverLoader(); - var $v = $(''); - - var $video = $(''); - - //$cover.append($video); - - 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 暂停" ); }, /**