Constructor
new RequestIdSession(webTransportnon-null, controlStreamnon-null, dialectnon-null, confignon-null)
Parameters:
| Name | Type | Description |
|---|---|---|
webTransport |
WebTransport | |
controlStream |
shaka.msf.IControlStream | |
dialect |
shaka.extern.MsfDialect | |
config |
shaka.extern.MsfManifestConfiguration |
- Implements:
- Source:
Members
fetchCallbacks_ :Map<bigint, !shaka.msf.Utils.ObjectCallback>
Type:
- Map<bigint, !shaka.msf.Utils.ObjectCallback>
- Source:
messageHandlers_ :Map<shaka.msf.Utils.MessageType, Map<bigint, shaka.msf.Utils.MessageHandler>>
Pending requests, keyed by the kind of response expected and then by the
Request ID that will carry it.
Type:
- Map<shaka.msf.Utils.MessageType, Map<bigint, shaka.msf.Utils.MessageHandler>>
- Source:
publishNamespaceCallbacks_ :Set<function(Array<string>)>
Type:
- Set<function(Array<string>)>
- Source:
Methods
close(codeopt, reasonopt) → {Promise}
Closes the underlying transport.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
code |
number |
<optional> |
0 | |
reason |
string |
<optional> |
- Implements:
- Source:
Returns:
- Type
- Promise
configure(confignon-null)
Parameters:
| Name | Type | Description |
|---|---|---|
config |
shaka.extern.MsfManifestConfiguration |
- Implements:
- Source:
fetch(namespace, trackName, callback) → {Promise}
Send a FETCH request for a track and register a callback for the
response data.
Returns a promise that resolves when the FETCH_OK is received.
Parameters:
| Name | Type | Description |
|---|---|---|
namespace |
Array<string> | |
trackName |
string | |
callback |
shaka.msf.Utils.ObjectCallback |
- Implements:
- Source:
Returns:
- Type
- Promise
getNextRequestId_() → {bigint}
Get the next request ID. Client request IDs are even numbers starting at
0, incrementing by 2.
- Source:
Returns:
- Type
- bigint
handleFetchStream_(readernon-null) → {Promise}
Handle an incoming FETCH_HEADER stream.
Parameters:
| Name | Type | Description |
|---|---|---|
reader |
shaka.msf.Reader |
- Source:
Returns:
- Type
- Promise
handleIncomingStream_(streamnon-null) → {Promise}
Handle an incoming unidirectional stream
Parameters:
| Name | Type | Description |
|---|---|---|
stream |
ReadableStream |
- Source:
Returns:
- Type
- Promise
handlePublishDone_(requestId)
Handle PublishDone message (end of stream for a track)
Parameters:
| Name | Type | Description |
|---|---|---|
requestId |
bigint |
- Source:
handlePublishNamespace_(msg) → {Promise}
The relay announces namespaces it can serve. Acknowledge, then tell
anyone listening.
Parameters:
| Name | Type | Description |
|---|---|---|
msg |
shaka.msf.Utils.PublishNamespace |
- Source:
Returns:
- Type
- Promise
handleSubgroupStream_(readernon-null, streamType) → {Promise}
Handle a SUBGROUP_HEADER stream with automatic buffering and retry.
Parameters:
| Name | Type | Description |
|---|---|---|
reader |
shaka.msf.Reader | |
streamType |
bigint |
- Source:
Returns:
- Type
- Promise
hasDefaultPriority_(streamType) → {boolean}
Draft-16: returns true when the DEFAULT_PRIORITY bit (0x20) is set
Parameters:
| Name | Type | Description |
|---|---|---|
streamType |
bigint |
- Source:
Returns:
- Type
- boolean
isSubgroupStreamType_(streamType) → {boolean}
Check if a stream type is a valid SUBGROUP_HEADER type.
Draft-11: 0x08-0x0D
Draft-14: 0x10-0x15, 0x18-0x1D
Draft-16: adds 0x30-0x35, 0x38-0x3D (with DEFAULT_PRIORITY bit 0x20)
Parameters:
| Name | Type | Description |
|---|---|---|
streamType |
bigint |
- Source:
Returns:
- Type
- boolean
listenForControlMessages_() → {Promise}
Reads control messages until the session closes, answering the ones the
session handles itself and routing the rest to whoever is waiting on that
Request ID.
- Source:
Returns:
- Type
- Promise
notifyCallbacks_(trackAlias, obj)
Notify all callbacks registered for a track
Parameters:
| Name | Type | Description |
|---|---|---|
trackAlias |
bigint | |
obj |
shaka.msf.Utils.MOQObject |
- Source:
onNamespacePublished(callback) → {function}
Registers a callback for namespaces the peer announces it can serve.
Parameters:
| Name | Type | Description |
|---|---|---|
callback |
function |
- Implements:
- Source:
Returns:
Unregisters the callback.
- Type
- function
registerMessageHandler_(kind, requestId, handler) → {function()}
Registers a one-shot handler for the response to a request.
Parameters:
| Name | Type | Description |
|---|---|---|
kind |
shaka.msf.Utils.MessageType | |
requestId |
bigint | |
handler |
shaka.msf.Utils.MessageHandler |
- Source:
Returns:
Unregisters the handler.
- Type
- function()
release()
Request that this object release all internal references.
- Inherited From:
- Implements:
- Source:
startListeningForStreams_() → {Promise}
Start listening for incoming unidirectional streams
- Source:
Returns:
- Type
- Promise
subscribe(namespace, trackName, callback, startLocationopt, nullable) → {Promise<bigint>}
Subscribe to a track by namespace and track name
Returns the track alias that can be used to unsubscribe later
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
namespace |
Array<string> | ||
trackName |
string | ||
callback |
shaka.msf.Utils.ObjectCallback | ||
startLocation |
shaka.msf.Utils.Location |
<optional> <nullable> |
- Implements:
- Source:
Returns:
- Type
- Promise<bigint>
unsubscribe(trackAlias) → {Promise}
Unsubscribe from a track by track alias
Parameters:
| Name | Type | Description |
|---|---|---|
trackAlias |
bigint |
- Implements:
- Source:
Returns:
- Type
- Promise
watchForSessionEnd_()
A session the peer hangs up on resets every stream on it at once, and
each of those failures would otherwise be logged as an error of its own.
Watch the transport instead: once the session is gone, its stream errors
are expected, and the reason the session ended is the one worth reporting.
- Source: