Skip to content

Parameter setManifestAcceptor

Description

The setManifestAcceptor method in TeleportConfiguration.Builder allows you to define a function for identifying the URL addresses of video stream manifests. This is a key parameter for the Teleport SDK, as it allows the SDK to accurately know which request pertains to a manifest, which is necessary for the correct operation of the peer-to-peer network.

Default Behavior

By default, the Teleport SDK identifies manifests by their extensions: .m3u8 (for HLS) or .mpd (for DASH).

When is it necessary?

If your media server uses specific or non-standard URL addresses for manifests that do not end with .m3u8 or .mpd, you need to define your own setManifestAcceptor function. This function will allow the Teleport SDK to correctly identify manifests for further processing.

Function Requirements

  • The function must accept a Uri and return a Boolean (true if the URL is a manifest).
  • Called on a background thread.

Example Usage

kotlin
TeleportConfiguration.Builder("YOUR_API_KEY")
        .setManifestAcceptor { uri: Uri ->
            // Example: identifies a manifest by extension or by the presence of a specific substring in the path
            uri.path?.let { it.endsWith(".m3u8") || it.endsWith(".mpd") || it.contains("my_custom_manifest") } ?: false
        }
        .build()

In this example, the setManifestAcceptor function will consider any URL ending with .m3u8 or .mpd, or containing the string "my_custom_manifest" in the path, as a manifest.