TeleportConfiguration Setup
For correct and optimal operation of the Teleport SDK in your Android application, you need to configure parameters via the TeleportConfiguration class. This class allows you to set various aspects of the SDK's behavior, adapting it to the specifics of your content and player.
Important
The API_KEY parameter is mandatory. It is recommended to use a separate key for Teleport Android SDK, which can be generated in the Teleport dashboard.
Full Configuration Example
Below is an example of TeleportConfiguration.Builder with all available parameters:
kotlin
TeleportConfiguration.Builder("YOUR_API_KEY") // Mandatory API key
.setScriptUrl("URL_FOR_SCRIPT") // URL for loading Teleport JS script
.setBufferSizeGetter { url: Uri -> -1L } // Function to get player buffer size
.setUrlCleaner { url: Uri -> url?.path.orEmpty() } // Function to clean URL
.setManifestAcceptor { url: Uri -> true } // Function to identify manifests
.setSegmentAcceptor { url: Uri -> true } // Function to identify segments
.setSegmentTypeGetter { url: Uri -> SegmentType.UNKNOWN } // Function to identify segment type
.setQualityGetter { url: Uri -> SegmentQuality.UNKNOWN } // Function to identify segment quality
.setSegmentResolver { url: Uri, segmentType: SegmentType, segmentQuality: SegmentQuality -> SegmentSource.TELEPORT } // Function to resolve segment source
.setTimeslotParser { url: Uri -> 0L } // Function to parse segment timeslot
.setSegmentStatListener { stat: SegmentStat -> /* Process statistics */ } // Segment statistics listener
.setTeleportConfiguredListener { /* Actions after Teleport configuration */ } // Teleport configuration event listener
.build()Available Configuration Parameters
Each of the following parameters is described in detail on a separate page:
setScriptUrl- URL for loading Teleport JS script.setBufferSizeGetter- Function to determine the current player buffer size.setUrlCleaner- Function for unifying URL addresses.setManifestAcceptor- Function to identify HTTP requests with a manifest.setSegmentAcceptor- Function to identify HTTP requests with a video segment.setSegmentTypeGetter- Function to identify the segment type.setQualityGetter- Function to determine the video stream quality.setSegmentResolver- Function for filtering segment requests.setTimeslotParser- Function to extract the segment number from the URL.setSegmentStatListener- Listener for receiving loaded segment statistics.setTeleportConfiguredListener- Listener to be called when Teleport is configured.