new Mp4Frag(optionsopt) → {Mp4Frag}
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
Configuration options.
Properties
|
Throws:
Will throw an error if options.hlsPlaylistBase contains characters other than letters(a-zA-Z) and underscores(_).
Returns:
this - Returns reference to new instance of Mp4Frag for chaining event listeners.
- Type
- Mp4Frag
Members
(readonly) audioCodec
Properties:
Name | Type | Description |
---|---|---|
mime |
String | null | - Returns the audio codec information as a String.
- Returns Null if requested before initialized event. |
(readonly) buffer
Properties:
Name | Type | Description |
---|---|---|
buffer |
Buffer | null | - Returns the Mp4Frag.initialization and Mp4Frag.segmentList concatenated as a single Buffer.
- Returns Null if requested before first segment event. |
(readonly) duration
Properties:
Name | Type | Description |
---|---|---|
duration |
Number | - Returns the duration of latest Mp4 segment as a Float(seconds).
- Returns -1 if requested before first segment event. |
(readonly) initialization
Properties:
Name | Type | Description |
---|---|---|
initialization |
Buffer | null | - Returns the Mp4 initialization fragment as a Buffer.
- Returns Null if requested before initialized event. |
(readonly) m3u8
Properties:
Name | Type | Description |
---|---|---|
m3u8 |
String | null | - Returns the fmp4 HLS m3u8 playlist as a String.
- Returns Null if requested before initialized event. |
(readonly) mime
Properties:
Name | Type | Description |
---|---|---|
mime |
String | null | - Returns the mime type information as a String.
- Returns Null if requested before initialized event. |
(readonly) segment
Properties:
Name | Type | Description |
---|---|---|
segment |
Buffer | null | - Returns the latest Mp4 segment as a Buffer.
- Returns Null if requested before first segment event. |
(readonly) segmentList
Properties:
Name | Type | Description |
---|---|---|
segmentList |
Buffer | null | - Returns the Mp4 segments concatenated as a single Buffer.
- Returns Null if requested before first segment event. |
(readonly) segmentObject
Properties:
Name | Type | Description |
---|---|---|
segmentObject |
Object | - Returns the latest Mp4 segment as an Object.
- {segment, sequence, duration, timestamp}
- Returns {segment: null, sequence: -1, duration: -1; timestamp: -1} if requested before first segment event. |
(readonly) segmentObjectList
Properties:
Name | Type | Description |
---|---|---|
segmentObjectList |
Array | null | - Returns the Mp4 segments as an Array of Objects
- [{buffer, sequence, duration, timestamp},...]
- Returns Null if requested before first segment event. |
(readonly) sequence
Properties:
Name | Type | Description |
---|---|---|
sequence |
Number | - Returns the sequence of the latest Mp4 segment as an Integer.
- Returns -1 if requested before first segment event. |
(readonly) timestamp
Properties:
Name | Type | Description |
---|---|---|
timestamp |
Number | - Returns the timestamp of the latest Mp4 segment as an Integer(milliseconds).
- Returns -1 if requested before first segment event. |
(readonly) videoCodec
Properties:
Name | Type | Description |
---|---|---|
mime |
String | null | - Returns the video codec information as a String.
- Returns Null if requested before initialized event. |
Methods
getSegment(sequence) → {Buffer|null}
Parameters:
Name | Type | Description |
---|---|---|
sequence |
Number | String | - Returns the Mp4 segment that corresponds to the numbered sequence as a Buffer.
- Returns Null if there is no segment that corresponds to sequence number. |
Returns:
- Type
- Buffer | null
getSegmentObject(sequence) → {Object|null}
Parameters:
Name | Type | Description |
---|---|---|
sequence |
Number | String | - Returns the Mp4 segment that corresponds to the numbered sequence as an Object.
- {buffer, sequence, duration, timestamp}
- Returns Null if there is no segment that corresponds to sequence number. |
Returns:
- Type
- Object | null
resetCache()
Clear cached values
Events
initialized
Fires when the init fragment of the Mp4 is parsed from the piped data.
Type:
- Event
Properties:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Object |
Object |
Properties
|
reset
Fires when resetCache() is called.
Type:
- Event
segment
Fires when the latest Mp4 segment is parsed from the piped data.
Type:
- Event
Properties:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Object |
Object | Mp4Frag.segmentObject
Properties
|