File tree Expand file tree Collapse file tree 7 files changed +13
-26
lines changed Expand file tree Collapse file tree 7 files changed +13
-26
lines changed Original file line number Diff line number Diff line change 207207 y : cameraLocation . cameraY ,
208208 z : cameraLocation . cameraZ
209209 } ,
210- autoplay : false ,
211210 styleOptions : {
212211 sprite : 'https://iclient.supermap.io/web/styles/street/sprite' ,
213212 glyphs :
Original file line number Diff line number Diff line change @@ -40,19 +40,10 @@ export default class VideoMapLayer extends mapboxgl.Evented {
4040 this . play ( ) ;
4141 }
4242 } ) ;
43- this . video . one ( 'ready' , ( ) => {
44- setTimeout ( ( ) => {
45- this . videoWidth = this . video . videoWidth ( ) ;
46- this . videoHeight = this . video . videoHeight ( ) ;
47- this . _addVideoLayer ( this . map ) ;
48- } , 1000 ) ;
49- } ) ;
5043 this . video . one ( 'canplay' , ( ) => {
51- setTimeout ( ( ) => {
52- if ( this . autoplay ) {
53- this . map . getSource ( this . id ) . play ( ) ;
54- }
55- } , 1500 ) ;
44+ this . videoWidth = this . video . videoWidth ( ) ;
45+ this . videoHeight = this . video . videoHeight ( ) ;
46+ this . _addVideoLayer ( this . map ) ;
5647 } ) ;
5748 }
5849
@@ -99,6 +90,9 @@ export default class VideoMapLayer extends mapboxgl.Evented {
9990 }
10091
10192 _afterAddVideoLayer ( ) {
93+ if ( this . autoplay ) {
94+ this . map . getSource ( this . id ) . play ( ) ;
95+ }
10296 this . fire ( 'loaded' , {
10397 originCoordsRightBottom : this . originCoordsRightBottom ,
10498 originCoordsLeftTop : this . originCoordsLeftTop ,
Original file line number Diff line number Diff line change 8888 this . video . one ( 'firstplay' , ( ) => {
8989 this . video . play ( ) ;
9090 } ) ;
91- this . video . one ( 'ready' , ( ) => {
92- setTimeout ( ( ) => {
93- this . videoWidth = this . video . videoWidth ( ) ;
94- this . videoHeight = this . video . videoHeight ( ) ;
95- this . _addVideoLayer ( this . map ) ;
96- } , 1000 ) ;
97- } ) ;
9891 this . video . one ( 'canplay' , ( ) => {
99- setTimeout ( ( ) => {
100- map . getSource ( this . layerId ) . play ( ) ;
101- } , 1500 ) ;
92+ this . videoWidth = this . video . videoWidth ( ) ;
93+ this . videoHeight = this . video . videoHeight ( ) ;
94+ this . _addVideoLayer ( this . map ) ;
10295 } ) ;
10396 }
10497
264257 source : this . layerId
265258 }
266259 ) ;
260+ map . getSource ( this . layerId ) . play ( ) ;
267261 } ) ;
268262 }
269263
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ module.exports = function (config) {
7070 { pattern : '../src/classic/libs/Lang/*.js' , included : true } ,
7171 { pattern : '../src/classic/theme/default/*.css' , included : true } ,
7272 { pattern : './resources/data/**.fgb' , included : false } ,
73- { pattern : './resources/data/**.m3u8 ' , included : false } ,
73+ { pattern : './resources/data/**.mp4 ' , included : false } ,
7474 { pattern : './resources/img/**.svg' , included : false } ,
7575 { pattern : './resources/img/baiduTileTest.png' , included : false } ,
7676 /**测试文件**/
Original file line number Diff line number Diff line change 11import { VideoMap } from '../../../src/mapboxgl/mapping/VideoMap' ;
22import mapboxgl from 'mapbox-gl' ;
33import mbglmap from '../../tool/mock_mapboxgl_map' ;
4- var videoUrl = 'base/resources/data/index.m3u8 ' ;
4+ var videoUrl = 'base/resources/data/test.mp4 ' ;
55describe ( 'mapboxgl_videoMap' , ( ) => {
66 var originalTimeout ;
77 var testDiv ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { VideoLayer } from '../../../src/mapboxgl/overlay/VideoLayer';
22import mapboxgl from 'mapbox-gl' ;
33import mbglmap from '../../tool/mock_mapboxgl_map' ;
44var url = GlobeParameter . ChinaURL + '/zxyTileImage.png?z={z}&x={x}&y={y}' ;
5- var videoUrl = 'base/resources/data/index.m3u8 ' ;
5+ var videoUrl = 'base/resources/data/test.mp4 ' ;
66describe ( 'mapboxgl_VideoLayer' , ( ) => {
77 var originalTimeout ;
88 var testDiv , map ;
You can’t perform that action at this time.
0 commit comments