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

fix: prevent double source buffer ready on ie 11 #1015

Merged
merged 4 commits into from
Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 4 additions & 1 deletion src/source-updater.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,13 @@ export default class SourceUpdater extends videojs.EventTarget {
// two add buffers.
this.addOrChangeSourceBuffers(codecs);
this.createdSourceBuffers_ = true;
this.trigger('createdsourcebuffers');
if (this.ready()) {
this.trigger('ready');
}
// we trigger 'createdsourcebuffers' after ready as
// ie 11 synchronous sets up eme on createdsourcebuffers
// and we don't want to trigger ready here and there.
this.trigger('createdsourcebuffers');
}

/**
Expand Down
9 changes: 8 additions & 1 deletion test/videojs-http-streaming.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4640,7 +4640,14 @@ QUnit.test('integration: updates source updater after eme init', function(assert
sourceUpdater.on(
'createdsourcebuffers',
() => {
assert.notOk(sourceUpdater.hasInitializedAnyEme(), 'has not initialized eme yet');
let expected = false;

// IE initializes eme syncronously directly after source buffer
// creation
if (videojs.browser.IE_VERSION) {
expected = true;
}
assert.equal(sourceUpdater.hasInitializedAnyEme(), expected, 'correct eme state');
}
);

Expand Down