更新 infowindow-view.js

This commit is contained in:
钟进 2020-06-13 16:11:10 +00:00
parent 09d4268fea
commit db2da36f9a

View File

@ -9,6 +9,8 @@ var util = require('../../core/util');
var ESC_KEY = 27; var ESC_KEY = 27;
var player;
/** /**
* Usage: * Usage:
* var infowindow = new Infowindow({ * var infowindow = new Infowindow({
@ -177,7 +179,7 @@ var Infowindow = View.extend({
// var $video = $('<video class="video-js CDB-infowindow-media-item" controls data-setup="{}" width="100%"> <source src="" </source></video>'); // var $video = $('<video class="video-js CDB-infowindow-media-item" controls data-setup="{}" width="100%"> <source src="" </source></video>');
var $video = $('<video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" width="100%" height="264" \ 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"> \ poster="http://vjs.zencdn.net/v/oceans.png"> \
<source src="http://video.hulian100.cn:9090/live/S105.m3u8" type="application/x-mpegURL"></video>'); <source src="http://video.hulian100.cn:9090/live/S105.m3u8" type="application/x-mpegURL"></video>');
@ -200,8 +202,14 @@ var Infowindow = View.extend({
this._stopCoverLoader(); this._stopCoverLoader();
player = videojs('hls-video');
player.play();
return; return;
/*
var $cover = this.$('.js-cover'); var $cover = this.$('.js-cover');
var $img = this.$('.CDB-infowindow-media-item'); var $img = this.$('.CDB-infowindow-media-item');
var url = $img.attr('src'); var url = $img.attr('src');
@ -223,6 +231,7 @@ var Infowindow = View.extend({
if (numFields < 3 && imageDimensions.height >= this.$el.height()) { if (numFields < 3 && imageDimensions.height >= this.$el.height()) {
this._loadImageHook(imageDimensions, coverDimensions, url); this._loadImageHook(imageDimensions, coverDimensions, url);
} }
*/
}, },
// end video // end video
@ -623,6 +632,9 @@ var Infowindow = View.extend({
if (this.model.get('visibility')) { if (this.model.get('visibility')) {
this.model.set('visibility', false); this.model.set('visibility', false);
} }
if (player) player.dispose();
}, },
/** /**
@ -652,6 +664,8 @@ var Infowindow = View.extend({
hide: function (force) { hide: function (force) {
$(document).off('keyup', this._onKeyUp); $(document).off('keyup', this._onKeyUp);
if (force || !this.model.get('visibility')) this._animateOut(); if (force || !this.model.get('visibility')) this._animateOut();
if (palyer) player.pause();
}, },
_updateAndAdjustPan: function () { _updateAndAdjustPan: function () {