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

feat: make retryOnError be the default #7868

Merged
merged 2 commits into from
Aug 8, 2022
Merged
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
2 changes: 1 addition & 1 deletion src/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -3371,7 +3371,7 @@ class Player extends Component {
});

// Try another available source if this one fails before playback.
if (this.options_.retryOnError && sources.length > 1) {
if (sources.length > 1) {
const retry = () => {
// Remove the error modal
this.error(null);
Expand Down
7 changes: 2 additions & 5 deletions test/unit/player.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,9 @@ QUnit.test('should asynchronously fire error events during source selection', fu
log.error.restore();
});

QUnit.test('should retry setting source if error occurs and retryOnError: true', function(assert) {
QUnit.test('should retry setting source if error occurs', function(assert) {
const player = TestHelpers.makePlayer({
techOrder: ['html5'],
retryOnError: true,
sources: [
{ src: 'http://vjs.zencdn.net/v/oceans.mp4', type: 'video/mp4' },
{ src: 'http://vjs.zencdn.net/v/oceans2.mp4', type: 'video/mp4' },
Expand Down Expand Up @@ -439,10 +438,9 @@ QUnit.test('should retry setting source if error occurs and retryOnError: true',
player.dispose();
});

QUnit.test('should not retry setting source if retryOnError: true and error occurs during playback', function(assert) {
QUnit.test('should not retry setting source if error occurs during playback', function(assert) {
const player = TestHelpers.makePlayer({
techOrder: ['html5'],
retryOnError: true,
sources: [
{ src: 'http://vjs.zencdn.net/v/oceans.mp4', type: 'video/mp4' },
{ src: 'http://vjs.zencdn.net/v/oceans2.mp4', type: 'video/mp4' },
Expand Down Expand Up @@ -490,7 +488,6 @@ QUnit.test('should not retry setting source if retryOnError: true and error occu
QUnit.test('aborts and resets retryOnError behavior if new src() call made during a retry', function(assert) {
const player = TestHelpers.makePlayer({
techOrder: ['html5'],
retryOnError: true,
sources: [
{ src: 'http://vjs.zencdn.net/v/oceans.mp4', type: 'video/mp4' },
{ src: 'http://vjs.zencdn.net/v/oceans2.mp4', type: 'video/mp4' },
Expand Down
8 changes: 5 additions & 3 deletions test/unit/sourceset.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ const testSrc = {
src: 'http://example.com/testSrc.mp4',
type: 'video/mp4'
};
const sourceOne = {src: 'http://example.com/one.mp4', type: 'video/mp4'};
const sourceTwo = {src: 'http://example.com/two.mp4', type: 'video/mp4'};
const sourceThree = {src: 'http://example.com/three.mp4', type: 'video/mp4'};
// Using a real URL here makes the tests work with retryOnError by default
// however, this means that it may fail offline
const sourceOne = {src: 'https://vjs.zencdn.net/v/oceans.mp4?one', type: 'video/mp4'};
const sourceTwo = {src: 'https://vjs.zencdn.net/v/oceans.mp4?two', type: 'video/mp4'};
const sourceThree = {src: 'https://vjs.zencdn.net/v/oceans.mp4?three', type: 'video/mp4'};

if (!Html5.canOverrideAttributes()) {
qunitFn = 'skip';
Expand Down