mse-audio-wrapper
Advanced tools
Comparing version 1.0.1 to 1.1.0
{ | ||
"name": "mse-audio-wrapper", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Library to enable Media Source Extensions API playback for unsupported audio containers and raw codecs", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -19,6 +19,4 @@ # MSE (Media Source Extensions) Audio Wrapper | ||
## `MSEAudioWrapper` | ||
## [`MSEAudioWrapper`](https://github.com/eshaz/mse-audio-wrapper/tree/master/src/MSEAudioWrapper.js) | ||
https://github.com/eshaz/mse-audio-wrapper/tree/master/src/MSEAudioWrapper.js | ||
A class that takes in audio (MP3, AAC, Ogg Flac, Ogg Opus, or Ogg Vorbis) and outputs ISOBMFF or WEBM. | ||
@@ -104,3 +102,6 @@ | ||
### Callbacks | ||
* `options.onCodecUpdate(codecInfo)` *optional* Called when there is a change in the codec header. `codecInfo` is an object containing information about the codec such as `bitrate`, `sampleRate`, etc. | ||
* `options.onMimeType(mimeType)` *optional* Called when the output mimeType is determined. | ||
* See `wrapper.mimeType` for a list of the possible output mimetypes | ||
* `options.onCodecUpdate(codecInfo)` *optional* Called when there is a change in the codec header. | ||
* `codecInfo` is an object containing information about the codec such as `bitrate`, `sampleRate`, etc. | ||
* `wrapper.iterator(data)` | ||
@@ -107,0 +108,0 @@ * Returns an Iterator that can be used in a `for ...of` loop to return wrapped audio |
@@ -28,2 +28,4 @@ /* Copyright 2020-2021 Ethan Halsall | ||
const noOp = () => {}; | ||
export default class MSEAudioWrapper { | ||
@@ -45,3 +47,4 @@ /** | ||
this.MIN_FRAMES_LENGTH = options.minBytesPerSegment || 1022; | ||
this._onCodecUpdate = options.onCodecUpdate || (() => {}); | ||
this._onCodecUpdate = options.onCodecUpdate || noOp; | ||
this._onMimeType = options.onMimeType || noOp; | ||
@@ -141,2 +144,3 @@ this._frames = []; | ||
this._container = this._getContainer(); | ||
this._onMimeType(this._mimeType); | ||
@@ -143,0 +147,0 @@ // yield the movie box along with a movie fragment containing frames |
143167
3371
136