Documentation Index
Fetch the complete documentation index at: https://mintlify.com/CeeblueTV/wrts-client/llms.txt
Use this file to discover all available pages before exploring further.
HTTPSource is a straightforward HTTP streaming source that opens a single persistent HTTP connection and streams media data in one continuous response body. It does not implement adaptive bitrate switching, rendition management, or sequence skipping. Unlike HTTPAdaptiveSource, it uses the Connect.Type.DIRECT_STREAMING connection type rather than the WRTS manifest-based approach, making it suited for fixed-quality streams or as a starting point for custom HTTP transport implementations.
HTTPAdaptiveSource is generally preferred for live streams. It provides adaptive bitrate switching, frame skipping, sequence recovery, and CMCD telemetry. Use HTTPSource when you need a simple, non-adaptive HTTP connection — for example, when working with fixed-quality streams or when building a custom source on top of the base HTTP infrastructure.See api/source for the full list of inherited properties and methods from the Source base class.Import
Registration
HTTPSource is not registered for any protocol via @Source.registerClass. It will not be selected automatically by the Player — you must pass it explicitly as the second constructor argument.
Constructor
HTTPSource. Internally calls super(playing, 'https', params, Connect.Type.DIRECT_STREAMING). The DIRECT_STREAMING connection type means the URL is built directly from the endpoint without the WRTS manifest path rewriting that HTTPAdaptiveSource performs.
The playback context providing buffer state and the stop signal.
Connection parameters including
endPoint, streamName, mediaExt, and optional query parameters.Usage
PassHTTPSource as the second argument to the Player constructor to use it explicitly:
How It Works
Track Negotiation via Query Parameters
Before issuing the HTTP request,HTTPSource appends codec-preference query parameters to the URL:
?audio=<id>— if a specific audio track is requested; otherwiseaac,|bestbps(best-bitrate AAC track)?video=<id>— if a specific video track is requested; otherwiseh264,|bestbps(best-bitrate H264 track)
Streaming Download Loop
HTTPSource enters a loop that:
- Calls
fetchWithRTT(url, playing)to open the HTTP connection and measure round-trip time. - On the first successful response, stores the measured RTT for use in live-time correction.
- Reads the response body in chunks using a
ReadableStreamreader. - Passes each chunk directly to a
Readerinstance (created once vianewReader()). - On any network error, waits 500 ms and retries the request from the beginning.
- Continues until
this.closedbecomestrue.
HTTPSource closes with a SourceError of type 'Request error' and does not retry.
Live Time Correction
HTTPSource overrides readMetadata() to apply an RTT-based correction to the stream’s live clock:
Behaviors That Differ from HTTPAdaptiveSource
Setting
player.reliable = false (after it has been set to true) throws an error — HTTPSource does not support switching back to unreliable mode. Only reliable = true is accepted by setReliability(). The default value is false, and no error is thrown on startup.Returns This means
true for HTTPSource because setTracks() is overridden — however, calling it throws:player.videoTrack and player.audioTrack setters will throw at runtime. Track selection must be configured before playback starts via onMetadata.Not supported. The base
Source implementation throws if you attempt to set cmcd to any value other than undefined. CMCD telemetry is only available in HTTPAdaptiveSource.Limitations
- No adaptive bitrate — a single video/audio track pair is selected at startup and held for the entire session.
- No sequence skipping — if the stream falls behind live, there is no mechanism to skip forward.
- No track switching at runtime —
setTracks()is overridden but throws; callingplayer.videoTrackorplayer.audioTracksetters will throw at runtime. - No CMCD — telemetry data is not attached to requests.
- No protocol auto-registration — must be supplied explicitly to
Player.
Usage Examples
- Basic playback
- Initial track selection via onMetadata
Comparison with Other Sources
| Feature | HTTPSource | HTTPAdaptiveSource | WSSource |
|---|---|---|---|
| Transport | HTTP (single stream) | HTTP/2 (multi-channel) | WebSocket (push) |
| Protocol auto-registration | ❌ None | ✅ https, http | ✅ wss, ws |
| Adaptive bitrate | ❌ | ✅ Full MBR | ❌ |
| CMCD telemetry | ❌ | ✅ NONE / SHORT / FULL | ❌ |
| Dynamic track selection | ❌ Throws | ✅ | ✅ |
| Unreliable mode | ❌ Throws | ✅ | ❌ Throws |
| Sequence skipping | ❌ | ✅ | ❌ |
| RTT-based live correction | ✅ | ✅ | ✅ |