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 207
207
y : cameraLocation . cameraY ,
208
208
z : cameraLocation . cameraZ
209
209
} ,
210
- autoplay : false ,
211
210
styleOptions : {
212
211
sprite : 'https://iclient.supermap.io/web/styles/street/sprite' ,
213
212
glyphs :
Original file line number Diff line number Diff line change @@ -40,19 +40,10 @@ export default class VideoMapLayer extends mapboxgl.Evented {
40
40
this . play ( ) ;
41
41
}
42
42
} ) ;
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
- } ) ;
50
43
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 ) ;
56
47
} ) ;
57
48
}
58
49
@@ -99,6 +90,9 @@ export default class VideoMapLayer extends mapboxgl.Evented {
99
90
}
100
91
101
92
_afterAddVideoLayer ( ) {
93
+ if ( this . autoplay ) {
94
+ this . map . getSource ( this . id ) . play ( ) ;
95
+ }
102
96
this . fire ( 'loaded' , {
103
97
originCoordsRightBottom : this . originCoordsRightBottom ,
104
98
originCoordsLeftTop : this . originCoordsLeftTop ,
Original file line number Diff line number Diff line change 88
88
this . video . one ( 'firstplay' , ( ) => {
89
89
this . video . play ( ) ;
90
90
} ) ;
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
- } ) ;
98
91
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 ) ;
102
95
} ) ;
103
96
}
104
97
264
257
source : this . layerId
265
258
}
266
259
) ;
260
+ map . getSource ( this . layerId ) . play ( ) ;
267
261
} ) ;
268
262
}
269
263
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ module.exports = function (config) {
70
70
{ pattern : '../src/classic/libs/Lang/*.js' , included : true } ,
71
71
{ pattern : '../src/classic/theme/default/*.css' , included : true } ,
72
72
{ pattern : './resources/data/**.fgb' , included : false } ,
73
- { pattern : './resources/data/**.m3u8 ' , included : false } ,
73
+ { pattern : './resources/data/**.mp4 ' , included : false } ,
74
74
{ pattern : './resources/img/**.svg' , included : false } ,
75
75
{ pattern : './resources/img/baiduTileTest.png' , included : false } ,
76
76
/**测试文件**/
Original file line number Diff line number Diff line change 1
1
import { VideoMap } from '../../../src/mapboxgl/mapping/VideoMap' ;
2
2
import mapboxgl from 'mapbox-gl' ;
3
3
import mbglmap from '../../tool/mock_mapboxgl_map' ;
4
- var videoUrl = 'base/resources/data/index.m3u8 ' ;
4
+ var videoUrl = 'base/resources/data/test.mp4 ' ;
5
5
describe ( 'mapboxgl_videoMap' , ( ) => {
6
6
var originalTimeout ;
7
7
var testDiv ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { VideoLayer } from '../../../src/mapboxgl/overlay/VideoLayer';
2
2
import mapboxgl from 'mapbox-gl' ;
3
3
import mbglmap from '../../tool/mock_mapboxgl_map' ;
4
4
var 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 ' ;
6
6
describe ( 'mapboxgl_VideoLayer' , ( ) => {
7
7
var originalTimeout ;
8
8
var testDiv , map ;
You can’t perform that action at this time.
0 commit comments