Class: ParseStream

ParseStream

new ParseStream()

A line-level M3U8 parser event stream. It expects to receive input one line at a time and performs a context-free parse of its contents. A stream interpretation of a manifest can be useful if the manifest is expected to be too large to fit comfortably into memory or the entirety of the input is not immediately available. Otherwise, it's probably much easier to work with a regular `Parser` object. Produces `data` events with an object that captures the parser's interpretation of the input. That object has a property `tag` that is one of `uri`, `comment`, or `tag`. URIs only have a single additional property, `line`, which captures the entirety of the input without interpretation. Comments similarly have a single additional property `text` which is the input without the leading `#`. Tags always have a property `tagType` which is the lower-cased version of the M3U8 directive without the `#EXT` or `#EXT-X-` prefix. For instance, `#EXT-X-MEDIA-SEQUENCE` becomes `media-sequence` when parsed. Unrecognized tags are given the tag type `unknown` and a single additional property `data` with the remainder of the input.
Source:

Extends

Methods

dispose()

Destroys the stream and cleans up.
Inherited From:
Source:

off(type, listener) → {Boolean}

Remove a listener for a specified event type.
Parameters:
Name Type Description
type String the event name
listener function a function previously registered for this type of event through `on`
Inherited From:
Source:
Returns:
if we could turn it off or not
Type
Boolean

on(type, listener)

Add a listener for a specified event type.
Parameters:
Name Type Description
type String the event name
listener function the callback to be invoked when an event of the specified type occurs
Inherited From:
Source:

pipe(destination)

Forwards all `data` events on this stream to the destination stream. The destination stream should provide a method `push` to receive the data events as they arrive.
Parameters:
Name Type Description
destination Stream the stream that will receive all `data` events
Inherited From:
Source:
See:

push(line)

Parses an additional line of input.
Parameters:
Name Type Description
line String a single line of an M3U8 file to parse
Source:

trigger(type)

Trigger an event of the specified type on this stream. Any additional arguments to this function are passed as parameters to event listeners.
Parameters:
Name Type Description
type String the event name
Inherited From:
Source: