Parameter urlCleaner
Description
The urlCleaner parameter provides a function for unifying URL addresses of video segments and manifests. Its main task is to remove any unique information from the URL that may change from user to user or from session to session, but does not affect the identification of the content itself.
Why is this needed?
For the correct operation of the Teleport PDN (Peer-to-Peer Delivery Network), it is extremely important that the URL of the same video segment or manifest is identical for all peers in the network. This allows the SDK to correctly match content and efficiently exchange it.
When is it necessary?
If your media server adds dynamic parameters to the URL (e.g., authorization tokens, session IDs, timestamps) that are not part of the unique content identifier, you need to use urlCleaner.
Consequences without urlCleaner
Without proper URL unification, the Teleport SDK may mistakenly consider the same segment as different content for different users, which prevents the formation of a peer-to-peer network and reduces the efficiency of P2P delivery.
Example Usage
let tlprt = await teleport.initialize({
apiKey: "YOUR_API_KEY", // Your API key
loader: {
type: "PLUGIN_ID", // Identifier of the player plugin used
params: {
// Function to clean the URL: leaves only the path, discarding query parameters
urlCleaner: url => (new URL(url)).pathname
}
}
});In this example, urlCleaner uses URL.pathname to get only the URL path, ignoring all query parameters. You can adapt this function to the specifics of your URLs.