Discovery URLs
Before the player can play an OptiView Live channel, it sends a discovery request to find the stream details of that channel (such as its manifest URLs and token security settings). OptiView Live channels are served by one of three discovery API versions:
| API version | Channels |
|---|---|
| V1 (legacy) | Channels created with the legacy THEOlive API. |
| V2 | Distributions created with the OptiView Live API. |
| V3 | Distributions served by the newest discovery API. |
The player does not know in advance which API version serves your channel. If you do not configure a discovery URL, the player tries its built-in discovery URLs one by one, in this order:
- V2
- V1 (legacy)
- V3
The player stops at the first discovery URL that returns the channel.
If your channel is not served by V2, the earlier requests fail before the right one succeeds.
These failed requests add a small delay before playback starts, and they show up as 404 responses in the network tab of your browser or in a network proxy.
The 404 responses are expected and do not mean that playback failed.
Why configure a discovery URL
When you configure the discovery URL that serves your channel, the player sends its first discovery request to that URL. This removes the failed requests and the extra startup delay.
Configured discovery URLs do not replace the built-in discovery URLs. The player tries them first, and continues with the built-in discovery URLs (V2, V1, V3) if the configured ones do not return the channel. A wrong discovery URL therefore costs one extra request, but it does not break playback.
On platforms that support both discoveryUrl and discoveryUrls, the player tries discoveryUrl first, then each URL of discoveryUrls in the order of the list, and then the built-in discovery URLs.
Which discovery URL to use
The player derives the API version from the path of the discovery URL, so use the URL exactly as listed for your platform, including the trailing /.
The URL for V1 channels is different on Web than on the other platforms.
| API version | Web | Android, iOS, Roku |
|---|---|---|
| V2 | https://discovery.theo.live/v2/distributions/ | https://discovery.theo.live/v2/distributions/ |
| V1 (legacy) | https://discovery.theo.live/ | https://discovery.theo.live/v2/publications/ |
| V3 | https://discovery.theo.live/v3/ | https://discovery.theo.live/v3/ |
React Native and Flutter apps pass the discovery URL to the underlying Web, Android or iOS SDK, so the same rules apply per platform.
Play your channel without a discovery URL and open the network tab of your browser (or a network proxy for a native app).
The discovery request that returns 200 shows the discovery URL that serves your channel.
For example, a request to https://discovery.theo.live/v2/distributions/<your-channel-id> means that your channel is served by V2.
Configure the discovery URL
Create a THEOliveConfiguration with the discovery URL and add it to the player configuration with setTHEOliveConfiguration.
For example, for a channel served by V2:
import THEOplayerSDK
import THEOplayerTHEOliveIntegration
let builder = THEOplayerConfigurationBuilder()
builder.license = "your-license"
builder.setTHEOliveConfiguration(
THEOliveConfiguration(
externalSessionId: nil,
discoveryUrl: "https://discovery.theo.live/v2/distributions/"
)
)
let player = THEOplayer(configuration: builder.build())
If your channels are served by different API versions, list the discovery URLs in the order you want the player to try them:
builder.setTHEOliveConfiguration(
THEOliveConfiguration(
externalSessionId: nil,
discoveryUrls: [
"https://discovery.theo.live/v2/distributions/",
"https://discovery.theo.live/v2/publications/",
]
)
)
The player derives the API version from the URL path:
- A URL that contains
/v3/is a V3 discovery URL. - A URL that contains
/v2/distributions/is a V2 discovery URL. - Any other URL, including
https://discovery.theo.live/v2/publications/, is a V1 discovery URL.
Because of these rules, https://discovery.theo.live/v2/ without distributions/ is treated as a V1 discovery URL on iOS.
Configuration reference
THEOliveConfiguration has the following properties, which you set with its initializer.
| Property | Type | Description |
|---|---|---|
externalSessionId | String? | An ID used to report usage analytics. If nil, a random UUID is used. |
discoveryUrl | String? | A discovery URL that the player tries before the built-in discovery URLs. Takes precedence over discoveryUrls. Defaults to nil. |
discoveryUrls | [String] | A list of discovery URLs that the player tries in order, after discoveryUrl and before the built-in discovery URLs. Defaults to []. |
The default discovery order V2, V1, V3 applies from THEOplayer 11.13.0. Earlier versions try V1 first.