VideoSource
定义于: src/source/video_source.ts:40
包含视频内容的数据源;有关选项的详细文档,请参见VideoSourceSpecification;
示例
// 添加到地图
map.addSource('some id', {
type: 'video',
url: [
'https://www.mapbox.com/blog/assets/baltimore-smoke.mp4',
'https://www.mapbox.com/blog/assets/baltimore-smoke.webm'
],
coordinates: [
[-76.54, 39.18],
[-76.52, 39.18],
[-76.52, 39.17],
[-76.54, 39.17]
]
});
// 更新
var mySource = map.getSource('some id');
mySource.setCoordinates([
[-76.54335737228394, 39.18579907229748],
[-76.52803659439087, 39.1838364847587],
[-76.5295386314392, 39.17683392507606],
[-76.54520273208618, 39.17876344106642]
]);
// 播放/暂停
var mySource = map.getSource('some id');
mySource.getVideo(); // 返回HTMLVideoElement对象
mySource.pause();
mySource.play();
map.removeSource('some id'); // 移除
继承
- ImageSource
方法
getVideo()
getVideo(): HTMLVideoElement
定义于: src/source/video_source.ts:127
返回HTML视频元素;
返回
HTMLVideoElement
HTML视频元素;
pause()
pause(): this
定义于: src/source/video_source.ts:146
暂停视频;
返回
this
play()
play(): this
定义于: src/source/video_source.ts:136
播放视频;
返回
this