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.

  • Unique id of the source.

    Declaration

    Swift

    public var identifier: String
  • url

    Unused for video sources but required by MTSource protocol. First URL from urls may be mirrored here if needed by callers.

    Declaration

    Swift

    public var url: URL?
  • URLs to video content in order of preferred format.

    Declaration

    Swift

    public var urls: [URL]
  • Corners of video specified as CLLocationCoordinate2D. Clockwise order: top-left, top-right, bottom-right, bottom-left.

    Declaration

    Swift

    public var coordinates: [CLLocationCoordinate2D]
  • Type of the source.

    Declaration

    Swift

    public private(set) var type: MTSourceType { get }
  • Initializes the video source with required values.

    Declaration

    Swift

    public init(identifier: String, urls: [URL], coordinates: [CLLocationCoordinate2D])

    Parameters

    identifier

    Unique id of the source.

    urls

    URLs to video content in order of preferred format.

    coordinates

    Corners of the video in clockwise order using CLLocationCoordinate2D.

Operations

  • 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

    coordinates

    New corners of the video using CLLocationCoordinate2D.

    mapView

    MTMapView which holds the source.

    completionHandler

    A handler block to execute when function finishes.

Concurrency

  • setCoordinates(_:in:) Asynchronous

    Updates the coordinates of the video source.

    Declaration

    Swift

    @MainActor
    public func setCoordinates(_ coordinates: [CLLocationCoordinate2D], in mapView: MTMapView) async

    Parameters

    coordinates

    New corners of the video using CLLocationCoordinate2D.

    mapView

    MTMapView which holds the source.

Playback controls

  • 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

    mapView

    MTMapView which holds the source.

    completionHandler

    A handler block to execute when function finishes.

  • 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

    mapView

    MTMapView which holds the source.

    completionHandler

    A handler block to execute when function finishes.

Playback controls (async)

  • play(in:) Asynchronous

    Starts playback of the video source (async).

    Declaration

    Swift

    @MainActor
    public func play(in mapView: MTMapView) async
  • pause(in:) Asynchronous

    Pauses playback of the video source (async).

    Declaration

    Swift

    @MainActor
    public func pause(in mapView: MTMapView) async

DSL