---
title: VideoSource
source: https://vjmap.com/doc/VideoSource.html
---

# VideoSource
**扩展图像源**


包含视频的数据源。（见`样式规范` 有关选项的详细文档。）

### Parameters
- `id` **`string`**
- `options` **视频源规范**
- `dispatcher` **调度员**
- `eventedParent` **`事件发生`**

### Examples
```
// add to map
map.addSource('some id', {
   type: 'video',
   url: [
       'http://xxx.mp4',
       'https://xxx.webm'
   ],
   coordinates: [
       [-76.54, 39.18],
       [-76.52, 39.18],
       [-76.52, 39.17],
       [-76.54, 39.17]
   ]
});

// update
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
```

### pause
暂停视频。

### play
播放视频。

### getVideo
返回 HTML`video`元素。

返回**`HTMLVideoElement `**HTML`video`元素。

### setCoordinates
设置视频的坐标并重新渲染地图。

返回**[VideoSource][263]**这个
