VideoSource

视频数据源。 继承至ImageSource


示例

// 添加到地图
map.addSource('some id', {
   type: 'video',
   url: [
       'https://blog/assets/baltimore-smoke.mp4',
       'https://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]
]);

// 移除
map.removeSource('some id');  // remove

方法

方法 返回值 描述
play() 播放
pause() 暂停
seek(seconds:number) 重播时间间隔,单位为秒
setCoordinates(coordinates) 设置坐标
getVideo() HTMLVideoElement 获取视频 HTML video element

results matching ""

    No results matching ""