---
title: "VideoSourceMLGL | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Class VideoSourceMLGL

A data source containing video. (See the [Style Specification](https://maplibre.org/maplibre-style-spec/#sources-video) for detailed documentation of options.)

#### Example[](#example)

```typescript
// add to map
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]
   ]
});

// update
let 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
```

#### See[](#see)

[Add a video](https://maplibre.org/maplibre-gl-js/docs/examples/video-on-a-map/)

Note that when rendered as a raster layer, the layer's `raster-fade-duration` property will cause the video to fade in. This happens when playback is started, paused and resumed, or when the video's coordinates are updated. To avoid this behavior, set the layer's `raster-fade-duration` property to `0`.

#### Hierarchy ([View Summary](https://docs.maptiler.com/sdk-js/api-reference/hierarchy/#VideoSourceMLGL))

-   [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/)
    -   VideoSourceMLGL

##### Index

### Constructors

[constructor](#constructor)

### Properties

[coordinates](#coordinates) [dispatcher](#dispatcher) [flippedWindingOrder](#flippedwindingorder) [id](#id) [image](#image) [imageWarp](#imagewarp) [map](#map) [maxzoom](#maxzoom) [minzoom](#minzoom) [options](#options) [roundZoom](#roundzoom) [terrainTileRanges](#terraintileranges) [texture](#texture) [tileCoords](#tilecoords) [tileID](#tileid) [tiles](#tiles) [tileSize](#tilesize) [type](#type) [url](#url) [urls](#urls) [video](#video)

### Methods

[fire](#fire) [getMesh](#getmesh) [getVideo](#getvideo) [getWarp](#getwarp) [hasTransition](#hastransition) [listens](#listens) [load](#load) [loaded](#loaded) [loadTile](#loadtile) [off](#off) [on](#on) [onAdd](#onadd) [once](#once) [onRemove](#onremove) [pause](#pause) [play](#play) [prepare](#prepare) [seek](#seek) [serialize](#serialize) [setCoordinates](#setcoordinates) [setEventedParent](#seteventedparent) [setWarp](#setwarp) [updateImage](#updateimage)

## Constructors

### constructor[](#constructor)

-   new VideoSourceMLGL(  
        id: string,  
        options: [VideoSourceSpecification](https://docs.maptiler.com/sdk-js/api-reference/types/VideoSourceSpecification/),  
        dispatcher: [Dispatcher](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Dispatcher/),  
        eventedParent: [Evented](https://docs.maptiler.com/sdk-js/api-reference/classes/Evented/),  
    ): VideoSourceMLGL[](#constructorvideosourcemlgl)
    
    #### Parameters
    
    -   id: string
    -   options: [VideoSourceSpecification](https://docs.maptiler.com/sdk-js/api-reference/types/VideoSourceSpecification/)
    -   dispatcher: [Dispatcher](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Dispatcher/)
    -   eventedParent: [Evented](https://docs.maptiler.com/sdk-js/api-reference/classes/Evented/)
    
    #### Returns VideoSourceMLGL
    
    Overrides [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[constructor](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#constructor)
    

## Properties

### coordinates[](#coordinates)

coordinates: [Coordinates](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.Coordinates/)

Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[coordinates](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#coordinates)

### dispatcher[](#dispatcher)

dispatcher: [Dispatcher](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Dispatcher/)

Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[dispatcher](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#dispatcher)

### flippedWindingOrder[](#flippedwindingorder)

flippedWindingOrder: boolean

Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[flippedWindingOrder](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#flippedwindingorder)

### id[](#id)

id: string

The id for the source. Must not be used by any existing source.

Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[id](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#id)

### image[](#image)

image: [ImageSourceImage](https://docs.maptiler.com/sdk-js/api-reference/types/ImageSourceImage/)

Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[image](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#image)

### imageWarp[](#imagewarp)

imageWarp: [RasterImageWarp](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.RasterImageWarp/)

Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[imageWarp](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#imagewarp)

### map[](#map)

map: [MapMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/MapMLGL/)

Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[map](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#map)

### maxzoom[](#maxzoom)

maxzoom: number

The maximum zoom level for the source.

Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[maxzoom](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#maxzoom)

### minzoom[](#minzoom)

minzoom: number

The minimum zoom level for the source.

Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[minzoom](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#minzoom)

### options[](#options)

options: [VideoSourceSpecification](https://docs.maptiler.com/sdk-js/api-reference/types/VideoSourceSpecification/)

Overrides [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[options](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#options)

### roundZoom[](#roundzoom)

roundZoom: boolean

### terrainTileRanges[](#terraintileranges)

terrainTileRanges: { \[zoom: string\]: [CanonicalTileRange](https://docs.maptiler.com/sdk-js/api-reference/types/CanonicalTileRange/) }

This object is used to store the range of terrain tiles that overlap with this tile. It is relevant for image tiles, as the image exceeds single tile boundaries.

Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[terrainTileRanges](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#terraintileranges)

### texture[](#texture)

texture: [Texture](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.Texture/) | null

Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[texture](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#texture)

### tileCoords[](#tilecoords)

tileCoords: [Point](https://docs.maptiler.com/sdk-js/api-reference/classes/Point/)\[\]

Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[tileCoords](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#tilecoords)

### tileID[](#tileid)

tileID: [CanonicalTileID](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.CanonicalTileID/)

Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[tileID](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#tileid)

### tiles[](#tiles)

tiles: { \[\_: string\]: [Tile](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Tile/) }

Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[tiles](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#tiles)

### tileSize[](#tilesize)

tileSize: number

The tile size for the source.

Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[tileSize](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#tilesize)

### type[](#type)

type: string

Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[type](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#type)

### url[](#url)

url: string

Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[url](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#url)

### urls[](#urls)

urls: string\[\]

### video[](#video)

video: [HTMLVideoElement](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.HTMLVideoElement/)

## Methods

### fire[](#fire)

-   fire(event: [ErrorEvent](https://docs.maptiler.com/sdk-js/api-reference/classes/ErrorEvent/) | [MapSourceDataEvent](https://docs.maptiler.com/sdk-js/api-reference/classes/MapSourceDataEvent/)): this[](#fire-1)
    
    Calls every listener registered for the event's type.
    
    #### Parameters
    
    -   event: [ErrorEvent](https://docs.maptiler.com/sdk-js/api-reference/classes/ErrorEvent/) | [MapSourceDataEvent](https://docs.maptiler.com/sdk-js/api-reference/classes/MapSourceDataEvent/)
    
    #### Returns this
    
    Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[fire](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#fire)
    
-   fire(type: keyof [SourceEventType](https://docs.maptiler.com/sdk-js/api-reference/types/SourceEventType/), properties?: object): this[](#fire-2)
    
    Compatibility with the (type: string, properties: Object) signature from previous versions. See [https://github.com/mapbox/mapbox-gl-js/issues/6522](https://github.com/mapbox/mapbox-gl-js/issues/6522), [https://github.com/mapbox/mapbox-gl-draw/issues/766](https://github.com/mapbox/mapbox-gl-draw/issues/766)
    
    #### Parameters
    
    -   type: keyof [SourceEventType](https://docs.maptiler.com/sdk-js/api-reference/types/SourceEventType/)
    -   `Optional`properties: object
    
    #### Returns this
    
    Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[fire](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#fire)
    

### getMesh[](#getmesh)

-   getMesh(context: [Context](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.Context/), projectionSubdividesTiles: boolean): [Mesh](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.Mesh/) | null[](#getmesh-1)
    
    #### Parameters
    
    -   context: [Context](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.Context/)
    -   projectionSubdividesTiles: boolean
    
    #### Returns [Mesh](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.Mesh/) | null
    
    #### Internal[](#internal)
    
    The mesh the image is drawn with, or null to use the tile mesh of the current projection.
    
    The raster vertex shader evaluates [imageWarp](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#imagewarp) per vertex, so a pair of triangles only samples it at the four corners. That is enough for the affine mapping of a parallelogram, and for a purely projective mapping, whose straight lines survive linear interpolation across the diagonal. Anything in between is neither, and would be textured as two independently warped halves with a visible seam along that diagonal, so it needs the warp evaluated per grid cell.
    
    A projection that subdivides its own tile meshes already does this, so it keeps them.
    
    Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[getMesh](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#getmesh)
    

### getVideo[](#getvideo)

-   getVideo(): [HTMLVideoElement](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.HTMLVideoElement/)[](#getvideo-1)
    
    Returns the HTML `video` element.
    
    #### Returns [HTMLVideoElement](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.HTMLVideoElement/)
    
    The HTML `video` element.
    

### getWarp[](#getwarp)

-   getWarp(): [ImageSourceWarp](https://docs.maptiler.com/sdk-js/api-reference/types/ImageSourceWarp/)[](#getwarp-1)
    
    #### Returns [ImageSourceWarp](https://docs.maptiler.com/sdk-js/api-reference/types/ImageSourceWarp/)
    
    The warp in use, see [ImageSourceWarp](https://docs.maptiler.com/sdk-js/api-reference/types/ImageSourceWarp/).
    
    #### Experimental[](#experimental)
    
    Returns how the image is warped onto its coordinates.
    
    Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[getWarp](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#getwarp)
    

### hasTransition[](#hastransition)

-   hasTransition(): boolean[](#hastransition-1)
    
    True if the source has transition, false otherwise.
    
    #### Returns boolean
    
    Overrides [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[hasTransition](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#hastransition)
    

### listens[](#listens)

-   listens(type: keyof [SourceEventType](https://docs.maptiler.com/sdk-js/api-reference/types/SourceEventType/)): boolean[](#listens-1)
    
    Returns a true if this instance of Evented or any forwardeed instances of Evented have a listener for the specified type.
    
    #### Parameters
    
    -   type: keyof [SourceEventType](https://docs.maptiler.com/sdk-js/api-reference/types/SourceEventType/)
        
        The event type
        
    
    #### Returns boolean
    
    `true` if there is at least one registered listener for specified event type, `false` otherwise
    
    Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[listens](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#listens)
    

### load[](#load)

-   load(): Promise<void\>[](#load-1)
    
    #### Returns Promise<void\>
    
    Overrides [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[load](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#load)
    

### loaded[](#loaded)

-   loaded(): boolean[](#loaded-1)
    
    True if the source is loaded, false otherwise.
    
    #### Returns boolean
    
    Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[loaded](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#loaded)
    

### loadTile[](#loadtile)

-   loadTile(tile: [Tile](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Tile/)): Promise<void\>[](#loadtile-1)
    
    This method does the heavy lifting of loading a tile. In most cases it will defer the work to the relevant worker source.
    
    #### Parameters
    
    -   tile: [Tile](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Tile/)
        
        The tile to load
        
    
    #### Returns Promise<void\>
    
    Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[loadTile](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#loadtile)
    

### off[](#off)

-   off<[T](#offt) extends keyof [SourceEventType](https://docs.maptiler.com/sdk-js/api-reference/types/SourceEventType/)\>(  
        type: [T](https://docs.maptiler.com/sdk-js/api-reference/classes/MaptilerGeolocateControl/#offt),  
        listener: (event: [SourceEventType](https://docs.maptiler.com/sdk-js/api-reference/types/SourceEventType/)\[[T](https://docs.maptiler.com/sdk-js/api-reference/classes/MaptilerGeolocateControl/#offt)\]) \=> void,  
    ): this[](#off-1)
    
    Removes a previously registered event listener.
    
    #### Type Parameters
    
    -   T extends keyof [SourceEventType](https://docs.maptiler.com/sdk-js/api-reference/types/SourceEventType/)
    
    #### Parameters
    
    -   type: [T](https://docs.maptiler.com/sdk-js/api-reference/classes/MaptilerGeolocateControl/#offt)
        
        The event type to remove listeners for.
        
    -   listener: (event: [SourceEventType](https://docs.maptiler.com/sdk-js/api-reference/types/SourceEventType/)\[[T](https://docs.maptiler.com/sdk-js/api-reference/classes/MaptilerGeolocateControl/#offt)\]) \=> void
        
        The listener function to remove.
        
    
    #### Returns this
    
    Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[off](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#off)
    

### on[](#on)

-   on<[T](#ont) extends keyof [SourceEventType](https://docs.maptiler.com/sdk-js/api-reference/types/SourceEventType/)\>(  
        type: [T](https://docs.maptiler.com/sdk-js/api-reference/classes/MaptilerGeolocateControl/#ont),  
        listener: (event: [SourceEventType](https://docs.maptiler.com/sdk-js/api-reference/types/SourceEventType/)\[[T](https://docs.maptiler.com/sdk-js/api-reference/classes/MaptilerGeolocateControl/#ont)\]) \=> void,  
    ): [Subscription](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Subscription/)[](#on-1)
    
    Adds a listener to a specified event type.
    
    #### Type Parameters
    
    -   T extends keyof [SourceEventType](https://docs.maptiler.com/sdk-js/api-reference/types/SourceEventType/)
    
    #### Parameters
    
    -   type: [T](https://docs.maptiler.com/sdk-js/api-reference/classes/MaptilerGeolocateControl/#ont)
        
        The event type to add a listen for.
        
    -   listener: (event: [SourceEventType](https://docs.maptiler.com/sdk-js/api-reference/types/SourceEventType/)\[[T](https://docs.maptiler.com/sdk-js/api-reference/classes/MaptilerGeolocateControl/#ont)\]) \=> void
        
        The function to be called when the event is fired. The listener function is called with the data object passed to `fire`, extended with `target` and `type` properties.
        
    
    #### Returns [Subscription](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Subscription/)
    
    Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[on](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#on)
    

### onAdd[](#onadd)

-   onAdd(map: [MapMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/MapMLGL/)): void[](#onadd-1)
    
    This method is called when the source is added to the map.
    
    #### Parameters
    
    -   map: [MapMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/MapMLGL/)
        
        The map instance
        
    
    #### Returns void
    
    Overrides [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[onAdd](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#onadd)
    

### once[](#once)

-   once<[T](#oncet) extends keyof [SourceEventType](https://docs.maptiler.com/sdk-js/api-reference/types/SourceEventType/)\>(type: [T](https://docs.maptiler.com/sdk-js/api-reference/classes/MaptilerGeolocateControl/#oncet)): Promise<[SourceEventType](https://docs.maptiler.com/sdk-js/api-reference/types/SourceEventType/)\[[T](https://docs.maptiler.com/sdk-js/api-reference/classes/MaptilerGeolocateControl/#oncet)\]\>[](#once-1)
    
    Adds a listener that will be called only once to a specified event type.
    
    The listener will be called first time the event fires after the listener is registered.
    
    #### Type Parameters
    
    -   T extends keyof [SourceEventType](https://docs.maptiler.com/sdk-js/api-reference/types/SourceEventType/)
    
    #### Parameters
    
    -   type: [T](https://docs.maptiler.com/sdk-js/api-reference/classes/MaptilerGeolocateControl/#oncet)
        
        The event type to listen for.
        
    
    #### Returns Promise<[SourceEventType](https://docs.maptiler.com/sdk-js/api-reference/types/SourceEventType/)\[[T](https://docs.maptiler.com/sdk-js/api-reference/classes/MaptilerGeolocateControl/#oncet)\]\>
    
    a promise that resolves with the event
    
    Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[once](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#once)
    
-   once<[T](#oncet-1) extends keyof [SourceEventType](https://docs.maptiler.com/sdk-js/api-reference/types/SourceEventType/)\>(  
        type: [T](https://docs.maptiler.com/sdk-js/api-reference/classes/MaptilerGeolocateControl/#oncet-1),  
        listener: (event: [SourceEventType](https://docs.maptiler.com/sdk-js/api-reference/types/SourceEventType/)\[[T](https://docs.maptiler.com/sdk-js/api-reference/classes/MaptilerGeolocateControl/#oncet-1)\]) \=> void,  
    ): this[](#once-2)
    
    Adds a listener that will be called only once to a specified event type.
    
    The listener will be called first time the event fires after the listener is registered.
    
    #### Type Parameters
    
    -   T extends keyof [SourceEventType](https://docs.maptiler.com/sdk-js/api-reference/types/SourceEventType/)
    
    #### Parameters
    
    -   type: [T](https://docs.maptiler.com/sdk-js/api-reference/classes/MaptilerGeolocateControl/#oncet-1)
        
        The event type to listen for.
        
    -   listener: (event: [SourceEventType](https://docs.maptiler.com/sdk-js/api-reference/types/SourceEventType/)\[[T](https://docs.maptiler.com/sdk-js/api-reference/classes/MaptilerGeolocateControl/#oncet-1)\]) \=> void
        
        The function to be called when the event is fired the first time.
        
    
    #### Returns this
    
    `this` when a listener is provided
    
    Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[once](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#once)
    

### onRemove[](#onremove)

-   onRemove(): void[](#onremove-1)
    
    This method is called when the source is removed from the map.
    
    #### Returns void
    
    Overrides [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[onRemove](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#onremove)
    

### pause[](#pause)

-   pause(): void[](#pause-1)
    
    Pauses the video.
    
    #### Returns void
    

### play[](#play)

-   play(): void[](#play-1)
    
    Plays the video.
    
    #### Returns void
    

### prepare[](#prepare)

-   prepare(): this[](#prepare-1)
    
    Sets the video's coordinates and re-renders the map.
    
    #### Returns this
    
    Overrides [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[prepare](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#prepare)
    

### seek[](#seek)

-   seek(seconds: number): void[](#seek-1)
    
    Sets playback to a timestamp, in seconds.
    
    #### Parameters
    
    -   seconds: number
    
    #### Returns void
    

### serialize[](#serialize)

-   serialize(): [VideoSourceSpecification](https://docs.maptiler.com/sdk-js/api-reference/types/VideoSourceSpecification/)[](#serialize-1)
    
    #### Returns [VideoSourceSpecification](https://docs.maptiler.com/sdk-js/api-reference/types/VideoSourceSpecification/)
    
    A plain (stringifiable) JS object representing the current state of the source. Creating a source using the returned object as the `options` should result in a Source that is equivalent to this one.
    
    Overrides [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[serialize](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#serialize)
    

### setCoordinates[](#setcoordinates)

-   setCoordinates(coordinates: [Coordinates](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.Coordinates/)): this[](#setcoordinates-1)
    
    Sets the image's coordinates and re-renders the map.
    
    #### Parameters
    
    -   coordinates: [Coordinates](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.Coordinates/)
        
        Four geographical coordinates, represented as arrays of longitude and latitude numbers, which define the corners of the image. The coordinates start at the top left corner of the image and proceed in clockwise order. They do not have to represent a rectangle.
        
    
    #### Returns this
    
    Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[setCoordinates](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#setcoordinates)
    

### setEventedParent[](#seteventedparent)

-   setEventedParent(  
        parent?: [Evented](https://docs.maptiler.com/sdk-js/api-reference/classes/Evented/)<[EventTypeMap](https://docs.maptiler.com/sdk-js/api-reference/types/EventTypeMap/)\> | null,  
        data?: [EventedParentData](https://docs.maptiler.com/sdk-js/api-reference/types/EventedParentData/) | (() \=> [EventedParentData](https://docs.maptiler.com/sdk-js/api-reference/types/EventedParentData/)),  
    ): this[](#seteventedparent-1)
    
    Bubble all events fired by this instance of Evented to this parent instance of Evented.
    
    #### Parameters
    
    -   `Optional`parent: [Evented](https://docs.maptiler.com/sdk-js/api-reference/classes/Evented/)<[EventTypeMap](https://docs.maptiler.com/sdk-js/api-reference/types/EventTypeMap/)\> | null
    -   `Optional`data: [EventedParentData](https://docs.maptiler.com/sdk-js/api-reference/types/EventedParentData/) | (() \=> [EventedParentData](https://docs.maptiler.com/sdk-js/api-reference/types/EventedParentData/))
    
    #### Returns this
    
    Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[setEventedParent](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#seteventedparent)
    

### setWarp[](#setwarp)

-   setWarp(warp: [ImageSourceWarp](https://docs.maptiler.com/sdk-js/api-reference/types/ImageSourceWarp/)): this[](#setwarp-1)
    
    #### Parameters
    
    -   warp: [ImageSourceWarp](https://docs.maptiler.com/sdk-js/api-reference/types/ImageSourceWarp/)
        
        The warp to use, see [ImageSourceWarp](https://docs.maptiler.com/sdk-js/api-reference/types/ImageSourceWarp/).
        
    
    #### Returns this
    
    #### Experimental[](#experimental-1)
    
    Sets how the image is warped onto its coordinates and re-renders the map.
    
    This only has an effect while the coordinates do not form a rectangle, and it is not part of the style specification, so it does not survive `map.setStyle`.
    
    #### Example[](#example-1)
    
    ```typescript
    // Keep the image pinned to its corners while the user drags them around.
    map.getSource('some id').setWarp('flat');
    ```
    
    Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[setWarp](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#setwarp)
    

### updateImage[](#updateimage)

-   updateImage(options: [UpdateImageOptions](https://docs.maptiler.com/sdk-js/api-reference/types/UpdateImageOptions/)): this[](#updateimage-1)
    
    Updates the image and, optionally, the coordinates. To avoid having the image flash after changing, set the `raster-fade-duration` paint property on the raster layer to 0.
    
    Provide exactly one of `url` (to fetch a new image over the network) or `image` (an already-decoded `HTMLImageElement`, `HTMLCanvasElement`, `ImageBitmap` or `ImageData` to display directly, without a network request).
    
    #### Parameters
    
    -   options: [UpdateImageOptions](https://docs.maptiler.com/sdk-js/api-reference/types/UpdateImageOptions/)
        
        The options object.
        
    
    #### Returns this
    
    Inherited from [ImageSourceMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/).[updateImage](https://docs.maptiler.com/sdk-js/api-reference/classes/ImageSourceMLGL/#updateimage)
