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:
parent
d4559b1ebe
commit
b0101a6b9b
@ -5115,6 +5115,9 @@ Player.prototype.options_ = {
|
||||
|
||||
html5: {},
|
||||
|
||||
// enable sourceset by default
|
||||
enableSourceset: true,
|
||||
|
||||
// default inactivity timeout
|
||||
inactivityTimeout: 2000,
|
||||
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user