更新 infowindow-view.js
This commit is contained in:
parent
2d52f63254
commit
c50b638e26
@ -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
|
||||
@ -120,6 +119,10 @@ var Infowindow = View.extend({
|
||||
this._loadVideo();
|
||||
}
|
||||
|
||||
if (this._containsH5url()) {
|
||||
this._loadH5url();
|
||||
}
|
||||
|
||||
this._setupClasses();
|
||||
this._renderScroll();
|
||||
this._renderShadows();
|
||||
@ -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 = $('<video class="video-js CDB-infowindow-media-item" controls data-setup="{}" width="100%"> <source src="" </source></video>');
|
||||
|
||||
var $video = $('<video id="hls-video" class="video-js vjs-default-skin" controls preload="none" width="100%" height="264" \
|
||||
poster="http://vjs.zencdn.net/v/oceans.png"> \
|
||||
<source src="http://video.hulian100.cn:9090/live/S105.m3u8" type="application/x-mpegURL"></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 暂停" );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user