1
0
mirror of https://github.com/videojs/video.js.git synced 2024-11-30 09:06:49 +02:00

feat: Enable sourceset by default (#7879)

Can still be disabled with enableSourceset: false
This commit is contained in:
Gary Katsevman 2022-08-18 12:13:26 -04:00 committed by Pat O'Neill
parent d4559b1ebe
commit b0101a6b9b
2 changed files with 46 additions and 0 deletions

View File

@ -5115,6 +5115,9 @@ Player.prototype.options_ = {
html5: {},
// enable sourceset by default
enableSourceset: true,
// default inactivity timeout
inactivityTimeout: 2000,

View File

@ -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() {