---
title: "MTVideoSource | Mobile sdk | Mobile sdk ios | Ios"
description: "A video source."
---

> 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.

# MTVideoSource

```
public class MTVideoSource : MTSource, @unchecked Sendable
```

A video source.

The `urls` value is an array. For each URL in the array, a video element source will be created. The `coordinates` array contains \[longitude, latitude\] pairs for the video corners listed in clockwise order: top left, top right, bottom right, bottom left.

-   `[identifier](#/s:11MapTilerSDK13MTVideoSourceC10identifierSSvp)`
    
    Unique id of the source.
    
    #### Declaration
    
    Swift
    
    ```
    public var identifier: String
    ```
    
-   `[url](#/s:11MapTilerSDK13MTVideoSourceC3url10Foundation3URLVSgvp)`
    
    Unused for video sources but required by `[MTSource](https://docs.maptiler.com/mobile-sdk/ios/api/Protocols/MTSource/)` protocol. First URL from `[urls](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTVideoSource/#/s:11MapTilerSDK13MTVideoSourceC4urlsSay10Foundation3URLVGvp)` may be mirrored here if needed by callers.
    
    #### Declaration
    
    Swift
    
    ```
    public var url: URL?
    ```
    
-   `[urls](#/s:11MapTilerSDK13MTVideoSourceC4urlsSay10Foundation3URLVGvp)`
    
    URLs to video content in order of preferred format.
    
    #### Declaration
    
    Swift
    
    ```
    public var urls: [URL]
    ```
    
-   `[coordinates](#/s:11MapTilerSDK13MTVideoSourceC11coordinatesSaySo22CLLocationCoordinate2DVGvp)`
    
    Corners of video specified as `CLLocationCoordinate2D`. Clockwise order: top-left, top-right, bottom-right, bottom-left.
    
    #### Declaration
    
    Swift
    
    ```
    public var coordinates: [CLLocationCoordinate2D]
    ```
    
-   `[type](#/s:11MapTilerSDK13MTVideoSourceC4typeAA12MTSourceTypeOvp)`
    
    Type of the source.
    
    #### Declaration
    
    Swift
    
    ```
    public private(set) var type: MTSourceType { get }
    ```
    
-   `[init(identifier:urls:coordinates:)](#/s:11MapTilerSDK13MTVideoSourceC10identifier4urls11coordinatesACSS_Say10Foundation3URLVGSaySo22CLLocationCoordinate2DVGtcfc)`
    
    Initializes the video source with required values.
    
    #### Declaration
    
    Swift
    
    ```
    public init(identifier: String, urls: [URL], coordinates: [CLLocationCoordinate2D])
    ```
    
    #### Parameters
    
    <table class="graybox"><tbody><tr><td><code><em>identifier</em></code></td><td><div><p>Unique id of the source.</p></div></td></tr><tr><td><code><em>urls</em></code></td><td><div><p>URLs to video content in order of preferred format.</p></div></td></tr><tr><td><code><em>coordinates</em></code></td><td><div><p>Corners of the video in clockwise order using <code>CLLocationCoordinate2D</code>.</p></div></td></tr></tbody></table>
    

[](#/Operations)

### Operations

-   `[setCoordinates(_:in:completionHandler:)](#/s:11MapTilerSDK13MTVideoSourceC14setCoordinates_2in17completionHandlerySaySo22CLLocationCoordinate2DVG_AA9MTMapViewCys6ResultOyytAA7MTErrorOGcSgtF)`
    
    Updates the coordinates of the video source.
    
    #### Declaration
    
    Swift
    
    ```
    @available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling")
    @MainActor
    public func setCoordinates(
        _ coordinates: [CLLocationCoordinate2D],
        in mapView: MTMapView,
        completionHandler: ((Result<Void, MTError>) -> Void)? = nil
    )
    ```
    
    #### Parameters
    
    <table class="graybox"><tbody><tr><td><code><em>coordinates</em></code></td><td><div><p>New corners of the video using <code>CLLocationCoordinate2D</code>.</p></div></td></tr><tr><td><code><em>mapView</em></code></td><td><div><p>MTMapView which holds the source.</p></div></td></tr><tr><td><code><em>completionHandler</em></code></td><td><div><p>A handler block to execute when function finishes.</p></div></td></tr></tbody></table>
    

[](#/Concurrency)

### Concurrency

-   `[setCoordinates(_:in:)](#/s:11MapTilerSDK13MTVideoSourceC14setCoordinates_2inySaySo22CLLocationCoordinate2DVG_AA9MTMapViewCtYaF)` Asynchronous
    
    Updates the coordinates of the video source.
    
    #### Declaration
    
    Swift
    
    ```
    @MainActor
    public func setCoordinates(_ coordinates: [CLLocationCoordinate2D], in mapView: MTMapView) async
    ```
    
    #### Parameters
    
    <table class="graybox"><tbody><tr><td><code><em>coordinates</em></code></td><td><div><p>New corners of the video using <code>CLLocationCoordinate2D</code>.</p></div></td></tr><tr><td><code><em>mapView</em></code></td><td><div><p>MTMapView which holds the source.</p></div></td></tr></tbody></table>
    

[](#/Playback%20controls)

### Playback controls

-   `[play(in:completionHandler:)](#/s:11MapTilerSDK13MTVideoSourceC4play2in17completionHandleryAA9MTMapViewC_ys6ResultOyytAA7MTErrorOGcSgtF)`
    
    Starts playback of the video source.
    
    #### Declaration
    
    Swift
    
    ```
    @available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling")
    @MainActor
    public func play(in mapView: MTMapView, completionHandler: ((Result<Void, MTError>) -> Void)? = nil)
    ```
    
    #### Parameters
    
    <table class="graybox"><tbody><tr><td><code><em>mapView</em></code></td><td><div><p>MTMapView which holds the source.</p></div></td></tr><tr><td><code><em>completionHandler</em></code></td><td><div><p>A handler block to execute when function finishes.</p></div></td></tr></tbody></table>
    
-   `[pause(in:completionHandler:)](#/s:11MapTilerSDK13MTVideoSourceC5pause2in17completionHandleryAA9MTMapViewC_ys6ResultOyytAA7MTErrorOGcSgtF)`
    
    Pauses playback of the video source.
    
    #### Declaration
    
    Swift
    
    ```
    @available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling")
    @MainActor
    public func pause(in mapView: MTMapView, completionHandler: ((Result<Void, MTError>) -> Void)? = nil)
    ```
    
    #### Parameters
    
    <table class="graybox"><tbody><tr><td><code><em>mapView</em></code></td><td><div><p>MTMapView which holds the source.</p></div></td></tr><tr><td><code><em>completionHandler</em></code></td><td><div><p>A handler block to execute when function finishes.</p></div></td></tr></tbody></table>
    

[](#/Playback%20controls%20%28async%29)

### Playback controls (async)

-   `[play(in:)](#/s:11MapTilerSDK13MTVideoSourceC4play2inyAA9MTMapViewC_tYaF)` Asynchronous
    
    Starts playback of the video source (async).
    
    #### Declaration
    
    Swift
    
    ```
    @MainActor
    public func play(in mapView: MTMapView) async
    ```
    
-   `[pause(in:)](#/s:11MapTilerSDK13MTVideoSourceC5pause2inyAA9MTMapViewC_tYaF)` Asynchronous
    
    Pauses playback of the video source (async).
    
    #### Declaration
    
    Swift
    
    ```
    @MainActor
    public func pause(in mapView: MTMapView) async
    ```
    

[](#/DSL)

### DSL

-   `[addToMap(_:)](#/s:11MapTilerSDK13MTVideoSourceC05addToA0yyAA9MTMapViewCF)`
    
    Adds source to map DSL style.
    
    Prefer `[addSource(_:)](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTStyle/#/s:11MapTilerSDK7MTStyleC9addSourceyyAA8MTSource_pYaKF)` on MTMapView instead.
    
    #### Declaration
    
    Swift
    
    ```
    public func addToMap(_ mapView: MTMapView)
    ```
