new Parser()
A parser for M3U8 files. The current interpretation of the input is
exposed as a property `manifest` on parser objects. It's just two lines to
create and parse a manifest once you have the contents available as a string:
```js
var parser = new videojs.m3u8.Parser();
parser.push(xhr.responseText);
```
New input can later be applied to update the manifest object by calling
`push` again.
The parser attempts to create a usable manifest object even if the
underlying input is somewhat nonsensical. It emits `info` and `warning`
events during the parse if it encounters input that seems invalid or
requires some property of the manifest object to be defaulted.
- Source:
Extends
Methods
dispose()
Destroys the stream and cleans up.
- Inherited From:
- Source:
end()
Flush any remaining input. This can be handy if the last line of an M3U8
manifest did not contain a trailing newline but the file has been
completely received.
- 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 |
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(chunk)
Parse the input string and update the manifest object.
Parameters:
Name | Type | Description |
---|---|---|
chunk |
String | a potentially incomplete portion of the manifest |
- 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: