Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass MediaSource object to onReady callback #149

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions dist/jmuxer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2295,7 +2295,11 @@
debug: false,
onReady: function onReady() {},
// function called when MSE is ready to accept frames
onError: function onError() {} // function called when jmuxer encounters any buffer related error
onError: function onError() {},
// function called when jmuxer encounters any buffer related errors
onMissingVideoFrames: function onMissingVideoFrames() {},
// function called when jmuxer encounters any missing video frames
onMissingAudioFrames: function onMissingAudioFrames() {} // function called when jmuxer encounters any missing audio frames

};
_this.options = Object.assign({}, defaults, options);
Expand Down Expand Up @@ -2430,6 +2434,11 @@
remux = true;
} else {
error('Failed to extract any NAL units from video data:', left);

if (typeof this.options.onMissingVideoFrames === 'function') {
this.options.onMissingVideoFrames.call(null, data);
}

return;
}
}
Expand All @@ -2442,6 +2451,11 @@
remux = true;
} else {
error('Failed to extract audio data from:', data.audio);

if (typeof this.options.onMissingAudioFrames === 'function') {
this.options.onMissingAudioFrames.call(null, data);
}

return;
}
}
Expand Down Expand Up @@ -2773,7 +2787,7 @@
URL.revokeObjectURL(this.url); // this.createBuffer();

if (typeof this.options.onReady === 'function') {
this.options.onReady.call(null, this.isReset);
this.options.onReady.call(null, this.isReset, this.mediaSource);
}
}
}, {
Expand Down
2 changes: 1 addition & 1 deletion dist/jmuxer.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion example/jmuxer.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/jmuxer.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ export default class JMuxer extends Event {
URL.revokeObjectURL(this.url);
// this.createBuffer();
if (typeof this.options.onReady === 'function') {
this.options.onReady.call(null, this.isReset);
this.options.onReady.call(null, this.isReset, this.mediaSource);
}
}

Expand Down