Class: shaka.msf.draft18.Session

Constructor

new Session(webTransportnon-null, controlWriternon-null, dialectnon-null, confignon-null)

Parameters:
Name Type Description
webTransport WebTransport
controlWriter shaka.msf.Writer Our outgoing control stream, already carrying our SETUP.
dialect shaka.extern.MsfDialect
config shaka.extern.MsfManifestConfiguration
Implements:
Source:

Members

isClosing_ :boolean

Type:
  • boolean
Source:

nextRequestId_ :bigint

Type:
  • bigint
Source:

publishNamespaceCallbacks_ :Set<function(Array<string>)>

Type:
  • Set<function(Array<string>)>
Source:

webTransport_ :WebTransport

Type:
  • WebTransport
Source:

Methods

awaitResponse_(readernon-null, okType, description) → {Promise<!shaka.msf.Reader>}

Waits for the response to a request, which is either a REQUEST_OK-shaped acknowledgement or a REQUEST_ERROR.
Parameters:
Name Type Description
reader shaka.msf.Reader
okType number The success message type for this request.
description string Used in error messages.
Source:
Returns:
The reader, positioned just after the response header.
Type
Promise<!shaka.msf.Reader>

buildSubscribeParams_() → {Array<shaka.msf.Utils.KeyValuePair>}

Builds the parameter list carried by SUBSCRIBE. Draft-16 moved the subscriber priority, forward flag, filter and group order out of fixed fields into parameters, and draft-18 keeps them there.
Source:
Returns:
Type
Array<shaka.msf.Utils.KeyValuePair>

close(codeopt, reasonopt) → {Promise}

Closes the underlying transport.
Parameters:
Name Type Attributes Description
code number <optional>
reason string <optional>
Implements:
Source:
Returns:
Type
Promise

configure(confignon-null)

Parameters:
Name Type Description
config shaka.extern.MsfManifestConfiguration
Implements:
Source:

deliver_(trackAlias, obj) → {Promise}

Delivers an object, waiting briefly for the subscription to be registered if the data stream beat the SUBSCRIBE_OK.
Parameters:
Name Type Description
trackAlias bigint
obj shaka.msf.Utils.MOQObject
Source:
Returns:
Type
Promise

fetch(namespace, trackName, callback) → {Promise}

Retrieves a track once rather than subscribing to it. Resolves when the request has been accepted; objects arrive on the callback.
Parameters:
Name Type Description
namespace Array<string>
trackName string
callback shaka.extern.MsfObjectCallback
Implements:
Source:
Returns:
Type
Promise

getNextRequestId_() → {bigint}

Client Request IDs are even and start at 0.
Source:
Returns:
Type
bigint

handleFetchStream_(readernon-null) → {Promise}

Parameters:
Name Type Description
reader shaka.msf.Reader
Source:
Returns:
Type
Promise

handleIncomingStream_(streamnon-null) → {Promise}

Parameters:
Name Type Description
stream ReadableStream
Source:
Returns:
Type
Promise

handlePeerControlStream_(readernon-null) → {Promise}

Reads the peer's SETUP and then keeps the control stream open for GOAWAY and namespace announcements.
Parameters:
Name Type Description
reader shaka.msf.Reader Positioned just after the SETUP type.
Source:
Returns:
Type
Promise

handleSubgroupStream_(readernon-null, streamType) → {Promise}

Parameters:
Name Type Description
reader shaka.msf.Reader
streamType bigint
Source:
Returns:
Type
Promise

isSubgroupStreamType_(streamType) → {boolean}

Draft-18 SUBGROUP_HEADER types have bit 4 set, spanning 0x10-0x1F, 0x30-0x3F, 0x50-0x5F and 0x70-0x7F.
Parameters:
Name Type Description
streamType bigint
Source:
Returns:
Type
boolean

listenOnRequestStream_(readernon-null, trackAlias) → {Promise}

Keeps reading a subscription's request stream after the SUBSCRIBE_OK so that PUBLISH_DONE closes the track.
Parameters:
Name Type Description
reader shaka.msf.Reader
trackAlias bigint
Source:
Returns:
Type
Promise

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

openRequest_(requestBytesnon-null) → {Promise<!shaka.msf.Reader>}

Opens a bidirectional stream, writes a request onto it and returns the reader the response will arrive on. The stream is the correlation, so nothing is registered anywhere.
Parameters:
Name Type Description
requestBytes Uint8Array
Source:
Returns:
Type
Promise<!shaka.msf.Reader>

readMessageHeader_(readernon-null) → {Promise<{type: number, length: number}>}

Reads one control message header from a stream.
Parameters:
Name Type Description
reader shaka.msf.Reader
Source:
Returns:
Type
Promise<{type: number, length: number}>

release()

Request that this object release all internal references.
Inherited From:
Implements:
Source:

startListeningForStreams_() → {Promise}

Reads incoming unidirectional streams. Each is either the peer's control stream, which begins with SETUP, or object data.
Source:
Returns:
Type
Promise

subscribe(namespace, trackName, callback) → {Promise<bigint>}

Subscribes to a track, delivering its objects to the callback until unsubscribed. Resolves with the track alias assigned by the publisher.
Parameters:
Name Type Description
namespace Array<string>
trackName string
callback shaka.extern.MsfObjectCallback
Implements:
Source:
Returns:
Type
Promise<bigint>

unsubscribe(trackAlias) → {Promise}

Stops delivery for a subscription.
Parameters:
Name Type Description
trackAlias bigint
Implements:
Source:
Returns:
Type
Promise