From 475353e747c27ad8ff7eeb08fed099d25ad9d804 Mon Sep 17 00:00:00 2001 From: Vineet Date: Thu, 8 Sep 2016 16:38:49 -0400 Subject: [PATCH 001/109] Add in a user-friendly message for disabled Flash in IE (#41) --- src/plugin.js | 10 ++++++++-- src/plugin.scss | 13 +++++++++++++ test/plugin.test.js | 18 ++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/plugin.js b/src/plugin.js index b902d50b..6b9e555d 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -2,6 +2,8 @@ import videojs from 'video.js'; import window from 'global/window'; import document from 'global/document'; +const FlashObj = videojs.getComponent('Flash'); + // Default options for the plugin. const defaults = { header: '', @@ -167,14 +169,18 @@ const onPlayerReady = (player, options) => { if (!error) { return; } - error = videojs.mergeOptions(error, options.errors[error.code || 0]); - if (error.message) { details = `
${player.localize('Technical details')} :
${player.localize(error.message)}
`; } + if (error.code === 4 && !FlashObj.isSupported()) { + const flashMessage = player.localize(' * If you are using an older browser' + + ' please try upgrading or installing Flash.'); + + details += `${flashMessage}`; + } display = player.getChild('errorDisplay'); // The code snippet below is to make sure we dispose any child closeButtons before // making the display closeable diff --git a/src/plugin.scss b/src/plugin.scss index 141413fe..f2f331c6 100644 --- a/src/plugin.scss +++ b/src/plugin.scss @@ -103,6 +103,12 @@ top: 0; } +.vjs-errors-flashmessage { + float: right; + font-size: 9px; + font-style: italic; +} + /* "Extra small" Styles ------------------------------------------------------------------------------- @@ -135,6 +141,9 @@ right: 0; } +.vjs-xs.vjs-errors-flashmessage { + display: none; +} /* Media query for player sizes of 600x250 or less. NOTE: This is a copy of the extra small styles above yet without ".vjs-xs". @@ -169,4 +178,8 @@ left: 0; right: 0; } + + .vjs-errors-flashmessage { + display:none; + } } diff --git a/test/plugin.test.js b/test/plugin.test.js index 3d695255..b9fc7da0 100644 --- a/test/plugin.test.js +++ b/test/plugin.test.js @@ -337,3 +337,21 @@ QUnit.test('custom error details should override defaults', function(assert) { assert.strictEqual(document.querySelector('.vjs-errors-message').textContent, customError.message, 'message should match custom override value'); }); + +QUnit.test('Append Flash error details when flash is not supported', function(assert) { + let oldIsSupported = videojs.getComponent('Flash').isSupported; + + // Mock up isSupported to be false + videojs.getComponent('Flash').isSupported = () => false; + + // tick forward enough to ready the player + this.clock.tick(1); + // trigger the error in question + this.player.error(4); + // confirm results + assert.equal(document.querySelector('.vjs-errors-flashmessage').textContent, + ' * If you are using an older browser please try upgrading or installing Flash.', + 'Flash Error message should be displayed'); + // Restoring isSupported to the old value + videojs.getComponent('Flash').isSupported = oldIsSupported; +}); From ccd36a4563c0d3c7d815fe9da281fcba026eaa72 Mon Sep 17 00:00:00 2001 From: Pat O'Neill Date: Thu, 8 Sep 2016 16:40:27 -0400 Subject: [PATCH 002/109] 1.1.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 211bcb61..a316b0db 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "videojs-errors", - "version": "1.0.5", + "version": "1.1.0", "author": "Brightcove", "description": "A VideoJS plugin for custom error reporting", "license": "Apache-2.0", From 7e7c9b816df92cba9fb50b51824d5c4c6a84c50a Mon Sep 17 00:00:00 2001 From: Matthew Neil Date: Thu, 10 Nov 2016 16:37:46 -0500 Subject: [PATCH 003/109] reinitialize plugin on multiple calls to errors --- src/plugin.js | 71 +++++++++++++++++++++++++-------------------------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/src/plugin.js b/src/plugin.js index 6b9e555d..dcdca11c 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -53,8 +53,9 @@ const defaults = { * triggers PLAYER_ERR_TIMEOUT if none occur within a reasonable * timeframe. */ -const monitorPlayback = function(player, options) { +const initPlugin = function(player, options) { let monitor; + let listeners = []; // clears the previous monitor timeout and sets up a new one const resetMonitor = function() { @@ -78,8 +79,6 @@ const monitorPlayback = function(player, options) { } }; - let listeners = []; - // clear any previously registered listeners const cleanup = function() { let listener; @@ -97,11 +96,11 @@ const monitorPlayback = function(player, options) { // playback isn't expected if the player is paused, shut // down monitoring if (player.paused()) { - return cleanup(); + return resetMonitor(); } // playback isn't expected once the video has ended if (player.ended()) { - return cleanup(); + return resetMonitor(); } fn.call(this); }; @@ -110,7 +109,7 @@ const monitorPlayback = function(player, options) { listeners.push([type, check]); }; - player.on('play', function() { + const onPlayStartMonitor = function() { let lastTime = 0; cleanup(); @@ -126,39 +125,18 @@ const monitorPlayback = function(player, options) { } }); healthcheck('progress', resetMonitor); - }); - - player.on('dispose', function() { - cleanup(); - }); -}; - -// Setup Custom Error Conditions -const initCustomErrorConditions = function(player, options) { - - // PLAYER_ERR_TIMEOUT - monitorPlayback(player, options); + }; - // PLAYER_ERR_NO_SRC - player.on('play', function() { + const onPlayNoSource = function() { if (!player.currentSrc()) { player.error({ code: -1, type: 'PLAYER_ERR_NO_SRC' }); } - }); -}; - -/** - * Set up the plugin. - */ -const onPlayerReady = (player, options) => { - - player.addClass('vjs-errors'); + }; - // Add to the error dialog when an error occurs - player.on('error', function() { + const onErrorHandler = function() { let display; let details = ''; let error = player.error(); @@ -212,19 +190,40 @@ const onPlayerReady = (player, options) => { videojs.on(okButton, 'click', function() { display.close(); }); + }; + + const onDisposeHandler = function() { + cleanup(); + + player.removeClass('vjs-errors'); + player.off('play', onPlayStartMonitor); + player.off('play', onPlayNoSource); + player.off('dispose', onDisposeHandler); + player.off('error', onErrorHandler); + }; + + const reInitPlugin = function(newOptions) { + onDisposeHandler(); + initPlugin(player, videojs.mergeOptions(defaults, newOptions)); + }; + + player.on('play', onPlayStartMonitor); + player.on('play', onPlayNoSource); + player.on('dispose', onDisposeHandler); + player.on('error', onErrorHandler); + + player.ready(() => { + player.addClass('vjs-errors'); }); - // Initialize custom error conditions - initCustomErrorConditions(player, options); + player.errors = reInitPlugin; }; /** * Initialize the plugin. Waits until the player is ready to do anything. */ const errors = function(options) { - this.ready(() => { - onPlayerReady(this, videojs.mergeOptions(defaults, options)); - }); + initPlugin(this, videojs.mergeOptions(defaults, options)); }; // Register the plugin with video.js. From cfeeaf30bbbe75d23c2dcd665d07ce370b507e82 Mon Sep 17 00:00:00 2001 From: Matthew Neil Date: Thu, 10 Nov 2016 18:22:04 -0500 Subject: [PATCH 004/109] add unit test --- test/plugin.test.js | 52 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/test/plugin.test.js b/test/plugin.test.js index b9fc7da0..def57699 100644 --- a/test/plugin.test.js +++ b/test/plugin.test.js @@ -108,6 +108,58 @@ QUnit.test('no progress for 45 seconds is an error', function(assert) { assert.strictEqual(this.player.error().type, 'PLAYER_ERR_TIMEOUT'); }); +QUnit.test('the plugin cleans up after its previous incarnation when called again', + function(assert) { + let errors = 0; + let oldOn = this.player.on.bind(this.player); + let oldOff = this.player.off.bind(this.player); + let onList = []; + let offList = []; + + this.player.on('error', () => errors++); + + this.player.on = (...args) => { + // QUnit attaches a listener with function name disposeFn, so dont push those to + // the list + if (args[1].name !== 'disposeFn') { + onList.push(args); + } + oldOn(...args); + }; + + this.player.off = (...args) => { + // QUnit attaches a listener with function name disposeFn, so dont push those to + // the list + if (args[1].name !== 'disposeFn') { + offList.push(args); + } + oldOff(...args); + }; + + this.player.src(sources); + this.player.trigger('play'); + this.player.errors(); + this.player.errors(); + this.player.on = oldOn; + this.player.off = oldOff; + this.player.trigger('play'); + this.clock.tick(46 * 1000); + + for (let i = 0, l = onList.length; i < l; i++) { + let on = onList[i]; + let off = offList[i]; + + // deepEqual since on[0] and off[0] can be an array + // e.g. ['timeupdate', 'adtimeupdate'] + assert.deepEqual(on[0], off[0], 'add and removed same type'); + assert.equal(on[1].name, off[1].name, 'add and removed same callback'); + } + + assert.strictEqual(errors, 1, 'emitted a single error'); + assert.strictEqual(this.player.error().code, -2, 'error code is -2'); + assert.strictEqual(this.player.error().type, 'PLAYER_ERR_TIMEOUT'); + }); + QUnit.test('when dispose is triggered should not throw error ', function(assert) { this.player.src(sources); this.player.trigger('play'); From 0d66a5c10c7397c43f05d2241ca3c99e25008fac Mon Sep 17 00:00:00 2001 From: Matthew Neil Date: Fri, 11 Nov 2016 14:18:00 -0500 Subject: [PATCH 005/109] simplify test --- test/plugin.test.js | 42 +++--------------------------------------- 1 file changed, 3 insertions(+), 39 deletions(-) diff --git a/test/plugin.test.js b/test/plugin.test.js index def57699..bfaae6ad 100644 --- a/test/plugin.test.js +++ b/test/plugin.test.js @@ -111,53 +111,17 @@ QUnit.test('no progress for 45 seconds is an error', function(assert) { QUnit.test('the plugin cleans up after its previous incarnation when called again', function(assert) { let errors = 0; - let oldOn = this.player.on.bind(this.player); - let oldOff = this.player.off.bind(this.player); - let onList = []; - let offList = []; this.player.on('error', () => errors++); - this.player.on = (...args) => { - // QUnit attaches a listener with function name disposeFn, so dont push those to - // the list - if (args[1].name !== 'disposeFn') { - onList.push(args); - } - oldOn(...args); - }; - - this.player.off = (...args) => { - // QUnit attaches a listener with function name disposeFn, so dont push those to - // the list - if (args[1].name !== 'disposeFn') { - offList.push(args); - } - oldOff(...args); - }; - - this.player.src(sources); - this.player.trigger('play'); this.player.errors(); this.player.errors(); - this.player.on = oldOn; - this.player.off = oldOff; this.player.trigger('play'); - this.clock.tick(46 * 1000); - - for (let i = 0, l = onList.length; i < l; i++) { - let on = onList[i]; - let off = offList[i]; - - // deepEqual since on[0] and off[0] can be an array - // e.g. ['timeupdate', 'adtimeupdate'] - assert.deepEqual(on[0], off[0], 'add and removed same type'); - assert.equal(on[1].name, off[1].name, 'add and removed same callback'); - } + this.clock.tick(1); assert.strictEqual(errors, 1, 'emitted a single error'); - assert.strictEqual(this.player.error().code, -2, 'error code is -2'); - assert.strictEqual(this.player.error().type, 'PLAYER_ERR_TIMEOUT'); + assert.strictEqual(this.player.error().code, -1, 'error code is -1'); + assert.strictEqual(this.player.error().type, 'PLAYER_ERR_NO_SRC'); }); QUnit.test('when dispose is triggered should not throw error ', function(assert) { From 706923aeb9dacacbc73cec4229a1637ad0bf08d1 Mon Sep 17 00:00:00 2001 From: Matthew Neil Date: Fri, 11 Nov 2016 14:22:23 -0500 Subject: [PATCH 006/109] fix test --- test/plugin.test.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/plugin.test.js b/test/plugin.test.js index bfaae6ad..8f6d8e0a 100644 --- a/test/plugin.test.js +++ b/test/plugin.test.js @@ -114,11 +114,15 @@ QUnit.test('the plugin cleans up after its previous incarnation when called agai this.player.on('error', () => errors++); + // Call plugin multiple times this.player.errors(); this.player.errors(); - this.player.trigger('play'); + + // Tick the clock forward enough to trigger the player to be "ready". this.clock.tick(1); + this.player.trigger('play'); + assert.strictEqual(errors, 1, 'emitted a single error'); assert.strictEqual(this.player.error().code, -1, 'error code is -1'); assert.strictEqual(this.player.error().type, 'PLAYER_ERR_NO_SRC'); From 0372968f9e81b29653ecb2fb5f63bdfd1e39e91f Mon Sep 17 00:00:00 2001 From: jrivera Date: Fri, 11 Nov 2016 15:27:14 -0500 Subject: [PATCH 007/109] updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e456aab6..2bb65521 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ CHANGELOG ========= ## HEAD (Unreleased) +* @mjneil Cleanup event bindings when reinitialized (#44) * @mkody Fix typo in French translation (#39) * @vdeshpande Close-button errors message accessible fix (#40) From 19d8d02b5139270ab0dddbdd23cf5cb2b4261033 Mon Sep 17 00:00:00 2001 From: jforbes Date: Fri, 11 Nov 2016 16:25:55 -0500 Subject: [PATCH 008/109] 1.1.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a316b0db..3cbf1a0e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "videojs-errors", - "version": "1.1.0", + "version": "1.1.1", "author": "Brightcove", "description": "A VideoJS plugin for custom error reporting", "license": "Apache-2.0", From 85a9b0c9a5b39748bc194e8123795b6dd451526d Mon Sep 17 00:00:00 2001 From: forbesjo Date: Wed, 7 Dec 2016 15:04:35 -0500 Subject: [PATCH 009/109] Error if Flash tech is unusable (#50) * Error if Flash tech is unusable * Return early if there already is an error * Added clarifying comments --- src/plugin.js | 39 +++++++++++++++++++++++++++++---------- test/plugin.test.js | 24 ++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 10 deletions(-) diff --git a/src/plugin.js b/src/plugin.js index dcdca11c..0b1dc816 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -61,9 +61,9 @@ const initPlugin = function(player, options) { const resetMonitor = function() { window.clearTimeout(monitor); monitor = window.setTimeout(function() { + // player already has an error + // or is not playing under normal conditions if (player.error() || player.paused() || player.ended()) { - // never overwrite existing errors or display a new one - // if the player is paused or ended. return; } @@ -74,6 +74,7 @@ const initPlugin = function(player, options) { }, options.timeout); // clear out any existing player timeout + // playback has recovered if (player.error() && player.error().code === -2) { player.error(null); } @@ -93,15 +94,32 @@ const initPlugin = function(player, options) { // creates and tracks a player listener if the player looks alive const healthcheck = function(type, fn) { let check = function() { - // playback isn't expected if the player is paused, shut - // down monitoring - if (player.paused()) { - return resetMonitor(); - } - // playback isn't expected once the video has ended - if (player.ended()) { - return resetMonitor(); + // if there's an error do not reset the monitor and + // clear the error unless time is progressing + if (!player.error()) { + // error if using Flash and its API is unavailable + let tech = player.$('.vjs-tech'); + + if (tech && + tech.type === 'application/x-shockwave-flash' && + !tech.vjs_getProperty) { + player.error({ + code: -2, + type: 'PLAYER_ERR_TIMEOUT' + }); + return; + } + + // playback isn't expected if the player is paused + if (player.paused()) { + return resetMonitor(); + } + // playback isn't expected once the video has ended + if (player.ended()) { + return resetMonitor(); + } } + fn.call(this); }; @@ -119,6 +137,7 @@ const initPlugin = function(player, options) { healthcheck(['timeupdate', 'adtimeupdate'], function() { let currentTime = player.currentTime(); + // playback is operating normally or has recovered if (currentTime !== lastTime) { lastTime = currentTime; resetMonitor(); diff --git a/test/plugin.test.js b/test/plugin.test.js index 8f6d8e0a..6f2dd530 100644 --- a/test/plugin.test.js +++ b/test/plugin.test.js @@ -108,6 +108,30 @@ QUnit.test('no progress for 45 seconds is an error', function(assert) { assert.strictEqual(this.player.error().type, 'PLAYER_ERR_TIMEOUT'); }); +QUnit.test('Flash API is unavailable when using Flash is an error', function(assert) { + this.player.tech_.el_.type = 'application/x-shockwave-flash'; + // when Flash dies the object methods go away + /* eslint-disable camelcase */ + this.player.tech_.el_.vjs_getProperty = null; + /* eslint-enable camelcase */ + this.player.paused = function() { + return true; + }; + + let errors = 0; + + this.player.on('error', function() { + errors++; + }); + this.player.src(sources); + this.player.trigger('play'); + this.player.trigger('timeupdate'); + + assert.strictEqual(errors, 1, 'emitted an error'); + assert.strictEqual(this.player.error().code, -2, 'error code is -2'); + assert.strictEqual(this.player.error().type, 'PLAYER_ERR_TIMEOUT'); +}); + QUnit.test('the plugin cleans up after its previous incarnation when called again', function(assert) { let errors = 0; From 2ebb356201f42ca494e47464669c0767f96c5272 Mon Sep 17 00:00:00 2001 From: jforbes Date: Wed, 7 Dec 2016 15:13:40 -0500 Subject: [PATCH 010/109] Update changelog --- CHANGELOG.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bb65521..c35d2bf8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,22 @@ CHANGELOG ========= ## HEAD (Unreleased) -* @mjneil Cleanup event bindings when reinitialized (#44) -* @mkody Fix typo in French translation (#39) -* @vdeshpande Close-button errors message accessible fix (#40) -------------------- +## v1.1.2 (2016-12-07) +* @forbesjo Error if Flash tech is unusable (#50) + +## v1.1.1 (2016-11-11) +* @mjneil Cleanup event bindings when reinitialized (#44) + +## v1.1.0 (2016-09-08) +* @vdeshpande Add in a user-friendly message for disabled Flash in IE (#41) + +## v1.0.5 (2016-08-10) +* @vdeshpande Close-button errors message accessible fix (#40) +* @mkody Fix typo in French translation (#39) + ## v1.0.4 (2016-04-13) * Added listening for `'adtimeupdate'` ([#36](https://github.com/brightcove/videojs-errors/pull/36)) * Added Arabic and Turkish ([#38](https://github.com/brightcove/videojs-errors/pull/38)) From 28319eeb89486c79abb154015287642d1e53db8a Mon Sep 17 00:00:00 2001 From: jforbes Date: Wed, 7 Dec 2016 15:14:14 -0500 Subject: [PATCH 011/109] 1.1.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3cbf1a0e..7b895445 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "videojs-errors", - "version": "1.1.1", + "version": "1.1.2", "author": "Brightcove", "description": "A VideoJS plugin for custom error reporting", "license": "Apache-2.0", From 48ed04a4f9c57ccfd3f66e3c5e89223f2f4c6409 Mon Sep 17 00:00:00 2001 From: Brandon Casey Date: Fri, 27 Jan 2017 12:02:42 -0500 Subject: [PATCH 012/109] refactor: Updates for Video.js 6.0 compatibility. --- src/plugin.js | 2 +- test/plugin.test.js | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/plugin.js b/src/plugin.js index 0b1dc816..0453bfd8 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -172,7 +172,7 @@ const initPlugin = function(player, options) { :
${player.localize(error.message)}
`; } - if (error.code === 4 && !FlashObj.isSupported()) { + if (error.code === 4 && FlashObj && !FlashObj.isSupported()) { const flashMessage = player.localize(' * If you are using an older browser' + ' please try upgrading or installing Flash.'); diff --git a/test/plugin.test.js b/test/plugin.test.js index 6f2dd530..e421352f 100644 --- a/test/plugin.test.js +++ b/test/plugin.test.js @@ -62,8 +62,8 @@ QUnit.test('registers itself with video.js', function(assert) { assert.expect(2); assert.strictEqual( - Player.prototype.errors, - plugin, + typeof Player.prototype.errors, + 'function', 'videojs-errors plugin was registered' ); @@ -383,6 +383,14 @@ QUnit.test('custom error details should override defaults', function(assert) { }); QUnit.test('Append Flash error details when flash is not supported', function(assert) { + const Flash = videojs.getTech('Flash'); + + // vjs6 won't have flash by default + if (!Flash) { + assert.notOk(Flash, 'flash tech not available, skipping unit test'); + return; + } + let oldIsSupported = videojs.getComponent('Flash').isSupported; // Mock up isSupported to be false From 8d5a912e8c30d939e5265531e1140a16519fa1e8 Mon Sep 17 00:00:00 2001 From: Pat O'Neill Date: Fri, 27 Jan 2017 12:04:16 -0500 Subject: [PATCH 013/109] 1.1.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7b895445..1117dd9f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "videojs-errors", - "version": "1.1.2", + "version": "1.1.3", "author": "Brightcove", "description": "A VideoJS plugin for custom error reporting", "license": "Apache-2.0", From 86d7807c96e001c64696a944536c598ca1025442 Mon Sep 17 00:00:00 2001 From: Brandon Casey Date: Thu, 9 Feb 2017 15:06:10 -0500 Subject: [PATCH 014/109] chore: update travis (#71) --- .travis.yml | 17 +++++------ package.json | 12 ++++---- test/karma.conf.js | 56 ++++++++++++++++++++++++++++++++++++ test/karma/chrome.js | 8 ------ test/karma/common.js | 65 ------------------------------------------ test/karma/detected.js | 32 --------------------- test/karma/firefox.js | 8 ------ test/karma/ie.js | 8 ------ test/karma/safari.js | 8 ------ 9 files changed, 71 insertions(+), 143 deletions(-) create mode 100644 test/karma.conf.js delete mode 100644 test/karma/chrome.js delete mode 100644 test/karma/common.js delete mode 100644 test/karma/detected.js delete mode 100644 test/karma/firefox.js delete mode 100644 test/karma/ie.js delete mode 100644 test/karma/safari.js diff --git a/.travis.yml b/.travis.yml index c0701691..cb8bf6fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,17 @@ sudo: false +dist: trusty language: node_js node_js: - 'node' - - '4.2' - - '0.12' - - '0.10' - -# Set up a virtual screen for Firefox. + - 'lts/argon' before_script: + - export CHROME_BIN=/usr/bin/google-chrome - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start - -# Use the latest version of Firefox. addons: - firefox: 'latest' + firefox: latest + apt: + sources: + - google-chrome + packages: + - google-chrome-stable diff --git a/package.json b/package.json index 1117dd9f..27f49fa9 100644 --- a/package.json +++ b/package.json @@ -37,11 +37,11 @@ "start": "npm-run-all -p start:serve watch", "start:serve": "babel-node scripts/server.js", "pretest": "npm-run-all lint build:test", - "test": "karma start test/karma/detected.js", - "test:chrome": "npm run pretest && karma start test/karma/chrome.js", - "test:firefox": "npm run pretest && karma start test/karma/firefox.js", - "test:ie": "npm run pretest && karma start test/karma/ie.js", - "test:safari": "npm run pretest && karma start test/karma/safari.js", + "test": "karma start test/karma.conf.js", + "test:chrome": "npm run pretest && karma start test/karma.conf.js --browsers Chrome", + "test:firefox": "npm run pretest && karma start test/karma.conf.js --browsers Firefox", + "test:ie": "npm run pretest && karma start test/karma.conf.js --browsers IE", + "test:safari": "npm run pretest && karma start test/karma.conf.js --browsers Safari", "preversion": "npm test", "version": "node scripts/npm-version-for-bower.js", "postversion": "git reset --hard HEAD~1", @@ -102,7 +102,7 @@ "dist-test", "docs", "es5", - "test/karma", + "test/karma.conf.js", "scripts" ] }, diff --git a/test/karma.conf.js b/test/karma.conf.js new file mode 100644 index 00000000..692d64df --- /dev/null +++ b/test/karma.conf.js @@ -0,0 +1,56 @@ +module.exports = function(config) { + var detectBrowsers = { + enabled: false, + usePhantomJS: false + }; + + // On Travis CI, we only want to run on Firefox, and Chrome. + if (process.env.TRAVIS) { + config.browsers = ['Firefox', 'travisChrome']; + } + + // If no browsers are specified, we enable `karma-detect-browsers` + // this will detect all browsers that are available for testing + if (!config.browsers.length) { + detectBrowsers.enabled = true; + } + + config.set({ + basePath: '..', + frameworks: ['qunit', 'browserify', 'detectBrowsers'], + + files: [ + 'node_modules/sinon/pkg/sinon.js', + 'node_modules/sinon/pkg/sinon-ie.js', + 'node_modules/video.js/dist/video.js', + 'node_modules/video.js/dist/video-js.css', + 'test/**/*.js' + ], + + detectBrowsers: detectBrowsers, + customLaunchers: { + travisChrome: { + base: 'Chrome', + flags: ['--no-sandbox'] + } + }, + reporters: ['dots'], + port: 9876, + colors: true, + autoWatch: false, + singleRun: true, + concurrency: Infinity, + exclude: [ + 'test/bundle.js' + ], + preprocessors: { + 'test/**/*.js': ['browserify'] + }, + browserify: { + transform: [ + 'babelify', + 'browserify-shim' + ] + } + }); +}; diff --git a/test/karma/chrome.js b/test/karma/chrome.js deleted file mode 100644 index c1530472..00000000 --- a/test/karma/chrome.js +++ /dev/null @@ -1,8 +0,0 @@ -var common = require('./common'); - -module.exports = function(config) { - config.set(common({ - plugins: ['karma-chrome-launcher'], - browsers: ['Chrome'] - })); -}; diff --git a/test/karma/common.js b/test/karma/common.js deleted file mode 100644 index f06a20cc..00000000 --- a/test/karma/common.js +++ /dev/null @@ -1,65 +0,0 @@ -var merge = require('lodash-compat/object/merge'); - -var DEFAULTS = { - basePath: '../..', - frameworks: ['browserify', 'qunit'], - - files: [ - 'node_modules/sinon/pkg/sinon.js', - 'node_modules/sinon/pkg/sinon-ie.js', - 'node_modules/video.js/dist/video.js', - 'test/**/*.js' - ], - - exclude: [ - 'test/bundle.js' - ], - - plugins: [ - 'karma-browserify', - 'karma-qunit' - ], - - preprocessors: { - 'test/**/*.js': ['browserify'] - }, - - reporters: ['dots'], - port: 9876, - colors: true, - autoWatch: false, - singleRun: true, - concurrency: Infinity, - - browserify: { - transform: [ - 'babelify', - 'browserify-shim' - ] - } -}; - -/** - * Customizes target/source merging with lodash merge. - * - * @param {Mixed} target - * @param {Mixed} source - * @return {Mixed} - */ -var customizer = function(target, source) { - if (Array.isArray(target)) { - return target.concat(source); - } -}; - -/** - * Generates a new Karma config with a common set of base configuration. - * - * @param {Object} custom - * Configuration that will be deep-merged. Arrays will be - * concatenated. - * @return {Object} - */ -module.exports = function(custom) { - return merge({}, custom, DEFAULTS, customizer); -}; diff --git a/test/karma/detected.js b/test/karma/detected.js deleted file mode 100644 index b4e23dee..00000000 --- a/test/karma/detected.js +++ /dev/null @@ -1,32 +0,0 @@ -var common = require('./common'); - -// Runs default testing configuration in multiple environments. - -module.exports = function(config) { - - // Travis CI should run in its available Firefox headless browser. - if (process.env.TRAVIS) { - - config.set(common({ - browsers: ['Firefox'], - plugins: ['karma-firefox-launcher'] - })) - } else { - config.set(common({ - - frameworks: ['detectBrowsers'], - - plugins: [ - 'karma-chrome-launcher', - 'karma-detect-browsers', - 'karma-firefox-launcher', - 'karma-ie-launcher', - 'karma-safari-launcher' - ], - - detectBrowsers: { - usePhantomJS: false - } - })); - } -}; diff --git a/test/karma/firefox.js b/test/karma/firefox.js deleted file mode 100644 index 8020d970..00000000 --- a/test/karma/firefox.js +++ /dev/null @@ -1,8 +0,0 @@ -var common = require('./common'); - -module.exports = function(config) { - config.set(common({ - plugins: ['karma-firefox-launcher'], - browsers: ['Firefox'] - })); -}; diff --git a/test/karma/ie.js b/test/karma/ie.js deleted file mode 100644 index 44f176fc..00000000 --- a/test/karma/ie.js +++ /dev/null @@ -1,8 +0,0 @@ -var common = require('./common'); - -module.exports = function(config) { - config.set(common({ - plugins: ['karma-ie-launcher'], - browsers: ['IE'] - })); -}; diff --git a/test/karma/safari.js b/test/karma/safari.js deleted file mode 100644 index 781a418b..00000000 --- a/test/karma/safari.js +++ /dev/null @@ -1,8 +0,0 @@ -var common = require('./common'); - -module.exports = function(config) { - config.set(common({ - plugins: ['karma-safari-launcher'], - browsers: ['Safari'] - })); -}; From 393718a6e8179ccf57763a95b9678c63aea2241b Mon Sep 17 00:00:00 2001 From: Pat O'Neill Date: Thu, 9 Feb 2017 15:06:26 -0500 Subject: [PATCH 015/109] Remove deprecation warning about using videojs.plugin (#72) --- src/plugin.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugin.js b/src/plugin.js index 0453bfd8..6cc5c319 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -4,6 +4,9 @@ import document from 'global/document'; const FlashObj = videojs.getComponent('Flash'); +// Video.js 5/6 cross-compatibility. +const registerPlugin = videojs.registerPlugin || videojs.plugin; + // Default options for the plugin. const defaults = { header: '', @@ -246,6 +249,6 @@ const errors = function(options) { }; // Register the plugin with video.js. -videojs.plugin('errors', errors); +registerPlugin('errors', errors); export default errors; From b83b97984455d54e49510c06ea0d1ae1f1f107ac Mon Sep 17 00:00:00 2001 From: Greenkeeper Date: Thu, 9 Feb 2017 21:35:09 +0100 Subject: [PATCH 016/109] chore(package): update portscanner to version 2.1.1 (#47) https://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 27f49fa9..59e6d1e5 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "minimist": "^1.2.0", "node-sass": "^3.4.0", "npm-run-all": "~1.2.0", - "portscanner": "^1.0.0", + "portscanner": "^2.1.1", "qunitjs": "^1.0.0", "serve-static": "^1.10.0", "shelljs": "^0.5.3", From f7d779369c25ba38de041de7271fda36752bb8ac Mon Sep 17 00:00:00 2001 From: Greenkeeper Date: Thu, 9 Feb 2017 21:35:26 +0100 Subject: [PATCH 017/109] chore(package): update node-sass to version 4.5.0 (#70) https://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 59e6d1e5..48d35714 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,7 @@ "karma-safari-launcher": "^0.1.0", "lodash-compat": "^3.10.0", "minimist": "^1.2.0", - "node-sass": "^3.4.0", + "node-sass": "^4.5.0", "npm-run-all": "~1.2.0", "portscanner": "^2.1.1", "qunitjs": "^1.0.0", From 7cd5e45b6131de8942e05820b4944b1635f70613 Mon Sep 17 00:00:00 2001 From: Greenkeeper Date: Thu, 9 Feb 2017 21:35:39 +0100 Subject: [PATCH 018/109] chore(package): update karma to version 1.4.1 (#69) https://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 48d35714..7502a268 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "browserify-shim": "^3.0.0", "connect": "^3.4.0", "cowsay": "^1.1.0", - "karma": "^0.13.0", + "karma": "^1.4.1", "karma-browserify": "^4.4.0", "karma-chrome-launcher": "^0.2.0", "karma-detect-browsers": "^2.0.0", From 9b966f61e96b51cc4321164121dd0bce96cc7308 Mon Sep 17 00:00:00 2001 From: Greenkeeper Date: Thu, 9 Feb 2017 21:35:51 +0100 Subject: [PATCH 019/109] chore(package): update shelljs to version 0.7.6 (#60) https://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7502a268..0e7a6406 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "portscanner": "^2.1.1", "qunitjs": "^1.0.0", "serve-static": "^1.10.0", - "shelljs": "^0.5.3", + "shelljs": "^0.7.6", "sinon": "1.14.1", "uglify-js": "^2.5.0", "videojs-languages": "^1.0.0", From e61edb65ea640af53d894bf36f2a85e899f1bc97 Mon Sep 17 00:00:00 2001 From: Greenkeeper Date: Thu, 9 Feb 2017 21:39:34 +0100 Subject: [PATCH 020/109] chore(package): update browserify to version 13.3.0 (#58) https://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0e7a6406..0d69543f 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "babel": "^5.8.0", "babelify": "^6.0.0", "bannerize": "^1.0.0", - "browserify": "^11.0.0", + "browserify": "^13.3.0", "browserify-shim": "^3.0.0", "connect": "^3.4.0", "cowsay": "^1.1.0", From 0b3f13dcf6cea8ccf64c635a3813cb0417123bc1 Mon Sep 17 00:00:00 2001 From: Greenkeeper Date: Thu, 9 Feb 2017 21:57:27 +0100 Subject: [PATCH 021/109] chore(package): update npm-run-all to version 3.1.2 (#48) https://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0d69543f..cfb0921f 100644 --- a/package.json +++ b/package.json @@ -74,7 +74,7 @@ "lodash-compat": "^3.10.0", "minimist": "^1.2.0", "node-sass": "^4.5.0", - "npm-run-all": "~1.2.0", + "npm-run-all": "~3.1.2", "portscanner": "^2.1.1", "qunitjs": "^1.0.0", "serve-static": "^1.10.0", From 894b922924a5507d94a61ed9de0319e2b37f22f5 Mon Sep 17 00:00:00 2001 From: Pat O'Neill Date: Thu, 9 Feb 2017 16:04:26 -0500 Subject: [PATCH 022/109] Update CHANGELOG --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c35d2bf8..a0b1e2e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,14 @@ CHANGELOG ========= ## HEAD (Unreleased) +* @misteroneill Remove deprecation warning about using videojs.plugin (#72) +* @BrandonOCasey Update Travis build to run w/ Video.js 5 and 6 (#71) -------------------- +## v1.1.3 (2017-01-27) +* @BrandonOCasey Updates for Video.js 6.0 compatibility. (#67) + ## v1.1.2 (2016-12-07) * @forbesjo Error if Flash tech is unusable (#50) From 31cf0fba2513bc4f47c104b0de48b2b2a02d7deb Mon Sep 17 00:00:00 2001 From: Pat O'Neill Date: Thu, 9 Feb 2017 16:09:27 -0500 Subject: [PATCH 023/109] Revert "chore(package): update shelljs to version 0.7.6 (#60)" This reverts commit 9b966f61e96b51cc4321164121dd0bce96cc7308. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cfb0921f..c47609fe 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "portscanner": "^2.1.1", "qunitjs": "^1.0.0", "serve-static": "^1.10.0", - "shelljs": "^0.7.6", + "shelljs": "^0.5.3", "sinon": "1.14.1", "uglify-js": "^2.5.0", "videojs-languages": "^1.0.0", From be9f76dd52a049d1e7025a0952bff6f9b5f781b4 Mon Sep 17 00:00:00 2001 From: Pat O'Neill Date: Thu, 9 Feb 2017 16:10:51 -0500 Subject: [PATCH 024/109] 1.1.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c47609fe..dba548b8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "videojs-errors", - "version": "1.1.3", + "version": "1.1.4", "author": "Brightcove", "description": "A VideoJS plugin for custom error reporting", "license": "Apache-2.0", From 652ca18c91b298a4a19093d2c6ab0f5e188da29a Mon Sep 17 00:00:00 2001 From: Gustavo Viegas Date: Tue, 21 Feb 2017 12:01:40 -0300 Subject: [PATCH 025/109] Created support to Portuguese (#42) --- lang/pt.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 lang/pt.json diff --git a/lang/pt.json b/lang/pt.json new file mode 100644 index 00000000..3f8dd956 --- /dev/null +++ b/lang/pt.json @@ -0,0 +1,12 @@ +{ + "No video has been loaded": "Nenhum vídeo foi carregado", + "Could not download the video": "Não foi possível realizar o download do vídeo", + "The video connection was lost, please confirm you are connected to the internet": "A conexão com o vídeo foi perdida. Por favor, confirme que está conectado a internet", + "The video is bad or in a format that cannot be played on your browser": "O vídeo está em um formato que o seu browser não suporta", + "This video is either unavailable or not supported in this browser": "O vídeo não está disponível ou não é suportado pelo seu browser", + "Error Code": "Código do Erro", + "Technical details": "Detalhes técnicos", + "The video download was cancelled": "O download do vídeo foi cancelado", + "The video you are trying to watch is encrypted and we do not know how to decrypt it": "O vídeo que você está tentando assistir é criptografado e nós não sabemos como decodificá-lo", + "An unanticipated problem was encountered, check back soon and try again": "Aconteceu um erro inesperado, tente novamente mais tarde" +} From adeac1aa8ee1d5f9973d53c91e61818f597bc9f0 Mon Sep 17 00:00:00 2001 From: Paul Dias Date: Tue, 21 Feb 2017 10:01:51 -0500 Subject: [PATCH 026/109] Allow errors to be non-dismissible (#54) * Allow errors to be non-dismissible * Consolidate error display and dismiss as default * Refactor dismiss and add unit tests * Refactor dismiss - Attach to modalclose event for player.error(null) - Remove double-binding of the closeButton - Remove disposal of child closeButtons before closeable - Attach to okButton on player rather than videojs * Add unit tests for dismiss * Update README.md - dismiss can be passed along with custom error - Default errors on iPhone no longer appear dismissible * Make closeable more clear * Build innerHTML string in separate variable --- README.md | 5 ++-- src/plugin.js | 56 +++++++++++++++++++++++++++------------------ test/plugin.test.js | 48 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 11fd82e1..ec3d1dcd 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,7 @@ NOTES: - Custom error definitions should be limited to the initCustomErrorConditions routine for encapsulation. - Custom errors should reference a code value of a negative integer. - Custom errors should reference a type beginning with 'PLAYER_ERR' versus the standardized 'MEDIA_ERR' to avoid confusion. +- Custom errors can be chosen to be dismissible (boolean value `true`) If the video element emits any of those errors, the corresponding error message will be displayed. You can override and add custom error codes by supplying options to the plugin: @@ -76,10 +77,10 @@ If the video element emits any of those errors, the corresponding error message If you define custom error messages, you'll need to let video.js know when to emit them yourself: - video.error({code: 'custom'}); + video.error({code: 'custom',dismiss: true}); If an error is emitted that doesn't have an associated key, a generic, catch-all message is displayed. You can override that text by supplying a message for the key `unknown`. ## Known Issues -On iPhones, the video element intercepts all user interaction so error message dialogs miss the tap events and don't dismiss themselves. If your video is busted anyways, you may not be that upset about this. +On iPhones, default errors are not dismissible. The video element intercepts all user interaction so error message dialogs miss the tap events. If your video is busted anyways, you may not be that upset about this. diff --git a/src/plugin.js b/src/plugin.js index 6cc5c319..49ccd4a0 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -3,6 +3,7 @@ import window from 'global/window'; import document from 'global/document'; const FlashObj = videojs.getComponent('Flash'); +const defaultDismiss = !videojs.browser.IS_IPHONE; // Video.js 5/6 cross-compatibility. const registerPlugin = videojs.registerPlugin || videojs.plugin; @@ -13,6 +14,7 @@ const defaults = { code: '', message: '', timeout: 45 * 1000, + dismiss: defaultDismiss, errors: { '1': { type: 'MEDIA_ERR_ABORTED', @@ -163,6 +165,8 @@ const initPlugin = function(player, options) { let details = ''; let error = player.error(); let content = document.createElement('div'); + let dialogContent = ''; + let closeable; // In the rare case when `error()` does not return an error object, // defensively escape the handler function. @@ -182,36 +186,44 @@ const initPlugin = function(player, options) { details += `${flashMessage}`; } display = player.getChild('errorDisplay'); - // The code snippet below is to make sure we dispose any child closeButtons before - // making the display closeable - if (display.getChild('closeButton')) { - display.removeChild('closeButton'); - } - // Make the error display closeable, and we should get a close button - display.closeable(true); + content.className = 'vjs-errors-dialog'; content.id = 'vjs-errors-dialog'; - content.innerHTML = - `
-

${this.localize(error.headline)}

-
${this.localize('Error Code')}: ${(error.type || error.code)}
- ${details} -
-
+ dialogContent = + `
+

${this.localize(error.headline)}

+
${this.localize('Error Code')}: ${(error.type || error.code)}
+ ${details} +
`; + + closeable = display.closeable(!('dismiss' in error) || error.dismiss); + + // We should get a close button + if (closeable) { + dialogContent += + `
`; - display.fillWith(content); - // Get the close button inside the error display - display.contentEl().firstChild.appendChild(display.getChild('closeButton').el()); + content.innerHTML = dialogContent; + display.fillWith(content); + // Get the close button inside the error display + display.contentEl().firstChild.appendChild(display.getChild('closeButton').el()); + + let okButton = display.el().querySelector('.vjs-errors-ok-button'); + + player.on(okButton, 'click', function() { + display.close(); + }); + } else { + content.innerHTML = dialogContent; + display.fillWith(content); + } + if (player.width() <= 600 || player.height() <= 250) { display.addClass('vjs-xs'); } - let okButton = display.el().querySelector('.vjs-errors-ok-button'); - - videojs.on(okButton, 'click', function() { - display.close(); - }); + display.one('modalclose', () => player.error(null)); }; const onDisposeHandler = function() { diff --git a/test/plugin.test.js b/test/plugin.test.js index e421352f..e00b67d5 100644 --- a/test/plugin.test.js +++ b/test/plugin.test.js @@ -407,3 +407,51 @@ QUnit.test('Append Flash error details when flash is not supported', function(as // Restoring isSupported to the old value videojs.getComponent('Flash').isSupported = oldIsSupported; }); + +QUnit.test('default error is dismissible', function(assert) { + // initialize the plugin + this.player.errors(); + // tick forward enough to ready the player + this.clock.tick(1); + // trigger the error in question + this.player.error(2); + // confirm results + assert.ok(document.querySelector('.vjs-errors-ok-button'), 'ok button is present'); + assert.ok(document.querySelector('.vjs-close-button'), 'close button is present'); +}); + +QUnit.test('custom error is dismissible', function(assert) { + let customErrorDismiss = { + headline: 'test headline', + message: 'test details', + dismiss: true + }; + + // initialize the plugin with custom options + this.player.errors({errors: {4: customErrorDismiss}}); + // tick forward enough to ready the player + this.clock.tick(1); + // trigger the error in question + this.player.error(4); + // confirm results + assert.ok(document.querySelector('.vjs-errors-ok-button'), 'ok button is present'); + assert.ok(document.querySelector('.vjs-close-button'), 'close button is present'); +}); + +QUnit.test('custom error is not dismissible', function(assert) { + let customErrorNoDimiss = { + headline: 'test headline', + message: 'test details', + dismiss: false + }; + + // initialize the plugin with custom options + this.player.errors({errors: {4: customErrorNoDimiss}}); + // tick forward enough to ready the player + this.clock.tick(1); + // trigger the error in question + this.player.error(4); + // confirm results + assert.ok(!document.querySelector('.vjs-errors-ok-button'), 'ok button is not present'); + assert.ok(!document.querySelector('.vjs-close-button'), 'close button is not present'); +}); From cad8fdd71dc2d1854e781a53182ec5a0057458bb Mon Sep 17 00:00:00 2001 From: Pat O'Neill Date: Tue, 21 Feb 2017 10:06:48 -0500 Subject: [PATCH 027/109] Update CHANGELOG and automation --- CHANGELOG.md | 8 ++++++-- scripts/npm-version-for-bower.js | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0b1e2e1..584d2473 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,15 @@ CHANGELOG ========= ## HEAD (Unreleased) -* @misteroneill Remove deprecation warning about using videojs.plugin (#72) -* @BrandonOCasey Update Travis build to run w/ Video.js 5 and 6 (#71) +* @gfviegas Add support for Portuguese ([#42](https://github.com/brightcove/videojs-errors/pull/42)) +* @bc-paul Allow errors to be non-dismissible ([#54](https://github.com/brightcove/videojs-errors/pull/54)) -------------------- +## v1.1.4 (2017-02-09) +* @misteroneill Remove deprecation warning about using videojs.plugin (#72) +* @BrandonOCasey Update Travis build to run w/ Video.js 5 and 6 (#71) + ## v1.1.3 (2017-01-27) * @BrandonOCasey Updates for Video.js 6.0 compatibility. (#67) diff --git a/scripts/npm-version-for-bower.js b/scripts/npm-version-for-bower.js index 4ade6990..a463814e 100755 --- a/scripts/npm-version-for-bower.js +++ b/scripts/npm-version-for-bower.js @@ -12,7 +12,8 @@ var exec = function() { return result; }; -exec('git add package.json'); +exec('chg release -y'); +exec('git add CHANGELOG.md package.json'); exec('git commit -m "' + VERSION + '"'); exec('npm run build'); exec('git add -f dist'); From b7ebfcd4a8210c1d741a0f9a5291119ffd84fe7f Mon Sep 17 00:00:00 2001 From: Pat O'Neill Date: Tue, 21 Feb 2017 10:12:57 -0500 Subject: [PATCH 028/109] 1.2.0 --- CHANGELOG.md | 7 +++++-- package.json | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 584d2473..12b57792 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,14 @@ CHANGELOG ========= ## HEAD (Unreleased) -* @gfviegas Add support for Portuguese ([#42](https://github.com/brightcove/videojs-errors/pull/42)) -* @bc-paul Allow errors to be non-dismissible ([#54](https://github.com/brightcove/videojs-errors/pull/54)) +_(none)_ -------------------- +## 1.2.0 (2017-02-21) +* @gfviegas Add support for Portuguese ([#42](https://github.com/brightcove/videojs-errors/pull/42)) +* @bc-paul Allow errors to be non-dismissible ([#54](https://github.com/brightcove/videojs-errors/pull/54)) + ## v1.1.4 (2017-02-09) * @misteroneill Remove deprecation warning about using videojs.plugin (#72) * @BrandonOCasey Update Travis build to run w/ Video.js 5 and 6 (#71) diff --git a/package.json b/package.json index dba548b8..8e1e98ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "videojs-errors", - "version": "1.1.4", + "version": "1.2.0", "author": "Brightcove", "description": "A VideoJS plugin for custom error reporting", "license": "Apache-2.0", From 0d71164c311a5540aac50f57d9fe0dcf1d87cddb Mon Sep 17 00:00:00 2001 From: Brandon Casey Date: Thu, 9 Mar 2017 10:44:20 -0500 Subject: [PATCH 029/109] fix: Fix tests for video.js 6 (#77) * update travis to test 5 & 6 * make queries local to errorDisplay rather than document --- .travis.yml | 13 +++++++++++++ test/plugin.test.js | 19 ++++++++++--------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index cb8bf6fa..db88ed77 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,9 +5,22 @@ node_js: - 'node' - 'lts/argon' before_script: + # check if the current version is equal to the version for the env + - 'export IS_INSTALLED="$(npm list video.js | grep "video.js@$VJS")"' + # we have to add semi colons to the end of each line in the if + # as travis runs this all on one line + - 'if [ -z "$IS_INSTALLED" ]; then + echo "INSTALLING video.js@>=$VJS.0.0-RC.0 <$(($VJS+1)).0.0"; + npm i "video.js@>=$VJS.0.0-RC.0 <\$(($VJS+1)).0.0"; + else + echo "video.js@$VJS ALREADY INSTALLED"; + fi' - export CHROME_BIN=/usr/bin/google-chrome - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start +env: + - VJS=5 + - VJS=6 addons: firefox: latest apt: diff --git a/test/plugin.test.js b/test/plugin.test.js index e00b67d5..dcbecc10 100644 --- a/test/plugin.test.js +++ b/test/plugin.test.js @@ -47,6 +47,7 @@ QUnit.module('videojs-errors', { // initialize the plugin with the default options this.player.errors(); + this.errorDisplay = this.player.getChild('errorDisplay'); // Tick forward so the player is ready. this.clock.tick(1); @@ -376,9 +377,9 @@ QUnit.test('custom error details should override defaults', function(assert) { // trigger the error in question this.player.error(4); // confirm results - assert.strictEqual(document.querySelector('.vjs-errors-headline').textContent, + assert.strictEqual(this.errorDisplay.$('.vjs-errors-headline').textContent, customError.headline, 'headline should match custom override value'); - assert.strictEqual(document.querySelector('.vjs-errors-message').textContent, + assert.strictEqual(this.errorDisplay.$('.vjs-errors-message').textContent, customError.message, 'message should match custom override value'); }); @@ -401,7 +402,7 @@ QUnit.test('Append Flash error details when flash is not supported', function(as // trigger the error in question this.player.error(4); // confirm results - assert.equal(document.querySelector('.vjs-errors-flashmessage').textContent, + assert.equal(this.errorDisplay.$('.vjs-errors-flashmessage').textContent, ' * If you are using an older browser please try upgrading or installing Flash.', 'Flash Error message should be displayed'); // Restoring isSupported to the old value @@ -416,8 +417,8 @@ QUnit.test('default error is dismissible', function(assert) { // trigger the error in question this.player.error(2); // confirm results - assert.ok(document.querySelector('.vjs-errors-ok-button'), 'ok button is present'); - assert.ok(document.querySelector('.vjs-close-button'), 'close button is present'); + assert.ok(this.errorDisplay.$('.vjs-errors-ok-button'), 'ok button is present'); + assert.ok(this.errorDisplay.$('.vjs-close-button'), 'close button is present'); }); QUnit.test('custom error is dismissible', function(assert) { @@ -434,8 +435,8 @@ QUnit.test('custom error is dismissible', function(assert) { // trigger the error in question this.player.error(4); // confirm results - assert.ok(document.querySelector('.vjs-errors-ok-button'), 'ok button is present'); - assert.ok(document.querySelector('.vjs-close-button'), 'close button is present'); + assert.ok(this.errorDisplay.$('.vjs-errors-ok-button'), 'ok button is present'); + assert.ok(this.errorDisplay.$('.vjs-close-button'), 'close button is present'); }); QUnit.test('custom error is not dismissible', function(assert) { @@ -452,6 +453,6 @@ QUnit.test('custom error is not dismissible', function(assert) { // trigger the error in question this.player.error(4); // confirm results - assert.ok(!document.querySelector('.vjs-errors-ok-button'), 'ok button is not present'); - assert.ok(!document.querySelector('.vjs-close-button'), 'close button is not present'); + assert.ok(!this.errorDisplay.$('.vjs-errors-ok-button'), 'ok button is not present'); + assert.ok(!this.errorDisplay.$('.vjs-close-button'), 'close button is not present'); }); From 12470b9cd5744daef38ed1c4ea7c65199da858fd Mon Sep 17 00:00:00 2001 From: Pat O'Neill Date: Thu, 13 Apr 2017 16:42:29 -0400 Subject: [PATCH 030/109] Re-run generator to get spellbook (#89) --- .github/ISSUE_TEMPLATE.md | 36 ++++++ .github/PULL_REQUEST_TEMPLATE.md | 14 +++ .gitignore | 4 +- .npmignore | 5 +- .travis.yml | 7 +- CONTRIBUTING.md | 30 +++++ LICENSE | 2 +- bower.json | 4 +- docs/index.md | 1 + index.html | 27 +++-- package.json | 125 +++++--------------- scripts/banner.ejs | 6 - scripts/npm-version-for-bower.js | 19 --- scripts/server.js | 34 ------ src/{plugin.scss => css/index.scss} | 156 +++++++++++++------------ src/{plugin.js => js/index.js} | 19 ++- test/index.html | 17 --- test/{plugin.test.js => index.test.js} | 10 +- test/karma.conf.js | 56 --------- 19 files changed, 232 insertions(+), 340 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 CONTRIBUTING.md create mode 100644 docs/index.md delete mode 100644 scripts/banner.ejs delete mode 100755 scripts/npm-version-for-bower.js delete mode 100644 scripts/server.js rename src/{plugin.scss => css/index.scss} (55%) rename src/{plugin.js => js/index.js} (94%) delete mode 100644 test/index.html rename test/{plugin.test.js => index.test.js} (98%) delete mode 100644 test/karma.conf.js diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..c0775cb3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,36 @@ +## Description +Briefly describe the issue. +Include a [reduced test case](https://css-tricks.com/reduced-test-cases/). + +## Steps to reproduce +Explain in detail the exact steps necessary to reproduce the issue. + +1. +2. +3. + +## Results +### Expected +Please describe what you expected to see. + +### Actual +Please describe what actually happened. + +### Error output +If there are any errors at all, please include them here. + +## Additional Information +Please include any additional information necessary here. Including the following: + +### versions +#### videojs +what version of videojs does this occur with? + +#### browsers +what browser are affected? + +#### OSes +what platforms (operating systems and devices) are affected? + +### plugins +are any videojs plugins being used on the page? If so, please list them below. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..dbb0a638 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,14 @@ +## Description +Please describe the change as necessary. +If it's a feature or enhancement please be as detailed as possible. +If it's a bug fix, please link the issue that it fixes or describe the bug in as much detail. + +## Specific Changes proposed +Please list the specific changes involved in this pull request. + +## Requirements Checklist +- [ ] Feature implemented / Bug fixed +- [ ] If necessary, more likely in a feature request than a bug fix + - [ ] Unit Tests updated or fixed + - [ ] Docs/guides updated +- [ ] Reviewed by Two Core Contributors diff --git a/.gitignore b/.gitignore index 0027a2f5..95ef803f 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,4 @@ node_modules/ # Build-related directories dist/ -dist-test/ -docs/api/ -es5/ + diff --git a/.npmignore b/.npmignore index c979e2f8..ea8c75d0 100644 --- a/.npmignore +++ b/.npmignore @@ -1,2 +1,3 @@ -test/ -*~ +# Intentionally left blank, so that npm does not ignore anything by default, +# but relies on the package.json "files" array to explicitly define what ends +# up in the package. diff --git a/.travis.yml b/.travis.yml index db88ed77..be303134 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,10 +5,11 @@ node_js: - 'node' - 'lts/argon' before_script: - # check if the current version is equal to the version for the env + # Check if the current version is equal to the major version for the env. - 'export IS_INSTALLED="$(npm list video.js | grep "video.js@$VJS")"' - # we have to add semi colons to the end of each line in the if - # as travis runs this all on one line + + # We have to add semicolons to the end of each line in the if as Travis runs + # this all on one line. - 'if [ -z "$IS_INSTALLED" ]; then echo "INSTALLING video.js@>=$VJS.0.0-RC.0 <$(($VJS+1)).0.0"; npm i "video.js@>=$VJS.0.0-RC.0 <\$(($VJS+1)).0.0"; diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..a184176c --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,30 @@ +# CONTRIBUTING + +We welcome contributions from everyone! + +## Getting Started + +Make sure you have NodeJS 0.10 or higher and npm installed. + +1. Fork this repository and clone your fork +1. Install dependencies: `npm install` +1. Run a development server: `npm start` + +### Making Changes + +Refer to the [video.js plugin conventions][conventions] for more detail on best practices and tooling for video.js plugin authorship. + +When you've made your changes, push your commit(s) to your fork and issue a pull request against the original repository. + +### Running Tests + +Testing is a crucial part of any software project. For all but the most trivial changes (typos, etc) test cases are expected. Tests are run in actual browsers using [Karma][karma]. + +- In all available and supported browsers: `npm test` +- In a specific browser: `npm run test:chrome`, `npm run test:firefox`, etc. +- While development server is running (`npm start`), navigate to [`http://localhost:9999/test/`][local] + + +[karma]: http://karma-runner.github.io/ +[local]: http://localhost:9999/test/ +[conventions]: https://github.com/videojs/generator-videojs-plugin/blob/master/docs/conventions.md diff --git a/LICENSE b/LICENSE index e4e41deb..50c17f4d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2016 Brightcove, Inc. +Copyright Brightcove, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/bower.json b/bower.json index 18009f66..963f0b72 100644 --- a/bower.json +++ b/bower.json @@ -3,10 +3,12 @@ "author": "Brightcove, Inc.", "license": "Apache-2.0", "main": [ - "dist/videojs-errors.min.js" + "dist/browser/videojs-errors.min.css", + "dist/browser/videojs-errors.min.js" ], "keywords": [ "videojs", "videojs-plugin" ] } + diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 00000000..59b95a3b --- /dev/null +++ b/docs/index.md @@ -0,0 +1 @@ +# Documentation for videojs-errors diff --git a/index.html b/index.html index 5123faf9..bd231f7a 100644 --- a/index.html +++ b/index.html @@ -4,13 +4,14 @@ videojs-errors Demo - + - +