Skip to content

Commit

Permalink
feat: Enable sourceset by default (#7879)
Browse files Browse the repository at this point in the history
Can still be disabled with enableSourceset: false
  • Loading branch information
gkatsev authored and misteroneill committed Nov 23, 2022
1 parent d4559b1 commit b0101a6
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -5115,6 +5115,9 @@ Player.prototype.options_ = {

html5: {},

// enable sourceset by default
enableSourceset: true,

// default inactivity timeout
inactivityTimeout: 2000,

Expand Down
43 changes: 43 additions & 0 deletions test/unit/sourceset.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,49 @@ const setupAfterEach = function(totalSourcesets) {
const testTypes = ['video el', 'change video el', 'audio el', 'change audio el', 'video-js', 'change video-js el'];

QUnit[qunitFn]('sourceset', function(hooks) {
QUnit.module('sourceset option', (subhooks) => testTypes.forEach((testName) => {
QUnit.module(testName, {
beforeEach() {

setupEnv(this, testName);
},
afterEach: setupAfterEach(1)
});

QUnit.test('sourceset enabled by default', function(assert) {
const done = assert.async();

this.mediaEl.setAttribute('data-setup', JSON.stringify({sources: [testSrc]}));
this.player = videojs(this.mediaEl, {});

this.player.one('sourceset', (e) => {
validateSource(this.player, [testSrc], e);
done();
});
});

QUnit.test('sourceset not triggered if turned off', function(assert) {
const done = assert.async();

this.player = videojs(this.mediaEl, {
enableSourceset: false
});

this.totalSourcesets = 0;

this.player.one('sourceset', (e) => {
this.totalSourcesets = 1;
});

this.player.on('loadstart', () => {
done();
});

this.player.src(testSrc);

});
}));

QUnit.module('source before player', (subhooks) => testTypes.forEach((testName) => {
QUnit.module(testName, {
beforeEach() {
Expand Down

0 comments on commit b0101a6

Please sign in to comment.