Socket
Socket
Sign inDemoInstall

videojs-errors

Package Overview
Dependencies
Maintainers
73
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

videojs-errors - npm Package Compare versions

Comparing version 4.1.3 to 4.2.0

13

CHANGELOG.md

@@ -0,1 +1,14 @@

<a name="4.2.0"></a>
# [4.2.0](https://github.com/brightcove/videojs-errors/compare/v4.1.3...v4.2.0) (2018-10-04)
### Bug Fixes
* ignore progress events ([#143](https://github.com/brightcove/videojs-errors/issues/143)) ([348f670](https://github.com/brightcove/videojs-errors/commit/348f670))
* Remove the postinstall script to prevent install issues ([#138](https://github.com/brightcove/videojs-errors/issues/138)) ([a2b2839](https://github.com/brightcove/videojs-errors/commit/a2b2839))
### Chores
* update to generator-videojs-plugin[@7](https://github.com/7).2.0 ([1e77e8c](https://github.com/brightcove/videojs-errors/commit/1e77e8c))
* **package:** update rollup to version 0.66.0 ([#140](https://github.com/brightcove/videojs-errors/issues/140)) ([459f9fb](https://github.com/brightcove/videojs-errors/commit/459f9fb))
<a name="4.1.3"></a>

@@ -2,0 +15,0 @@ ## [4.1.3](https://github.com/brightcove/videojs-errors/compare/v4.1.2...v4.1.3) (2018-08-23)

130

dist/videojs-errors.cjs.js

@@ -1,2 +0,2 @@

/*! @name videojs-errors @version 4.1.3 @license Apache-2.0 */
/*! @name videojs-errors @version 4.2.0 @license Apache-2.0 */
'use strict';

@@ -9,11 +9,9 @@

var version = "4.1.3";
var version = "4.2.0";
var FlashObj = videojs.getComponent('Flash');
var defaultDismiss = !videojs.browser.IS_IPHONE;
var defaultDismiss = !videojs.browser.IS_IPHONE; // Video.js 5/6 cross-compatibility.
// Video.js 5/6 cross-compatibility.
var registerPlugin = videojs.registerPlugin || videojs.plugin;
var registerPlugin = videojs.registerPlugin || videojs.plugin; // Default options for the plugin.
// Default options for the plugin.
var defaults = {

@@ -25,3 +23,2 @@ header: '',

dismiss: defaultDismiss,
progressDisabled: false,
errors: {

@@ -76,11 +73,10 @@ '1': {

var initPlugin = function initPlugin(player, options) {
var monitor = void 0;
var waiting = void 0;
var isStalling = void 0;
var monitor;
var waiting;
var isStalling;
var listeners = [];
var updateErrors = function updateErrors(updates) {
options.errors = videojs.mergeOptions(options.errors, updates);
options.errors = videojs.mergeOptions(options.errors, updates); // Create `code`s from errors which don't have them (based on their keys).
// Create `code`s from errors which don't have them (based on their keys).
Object.keys(options.errors).forEach(function (k) {

@@ -93,17 +89,17 @@ var err = options.errors[k];

});
};
}; // Make sure we flesh out initially-provided errors.
// Make sure we flesh out initially-provided errors.
updateErrors();
// clears the previous monitor timeout and sets up a new one
updateErrors(); // clears the previous monitor timeout and sets up a new one
var resetMonitor = function resetMonitor() {
// at this point the player has recovered
player.clearTimeout(waiting);
if (isStalling) {
isStalling = false;
player.removeClass('vjs-waiting');
}
} // start the loading spinner if player has stalled
// start the loading spinner if player has stalled
waiting = player.setTimeout(function () {

@@ -119,3 +115,2 @@ // player already has an error

}, 1000);
player.clearTimeout(monitor);

@@ -133,14 +128,13 @@ monitor = player.setTimeout(function () {

});
}, options.timeout);
}, options.timeout); // clear out any existing player timeout
// playback has recovered
// clear out any existing player timeout
// playback has recovered
if (player.error() && player.error().code === -2) {
player.error(null);
}
};
}; // clear any previously registered listeners
// clear any previously registered listeners
var cleanup = function cleanup() {
var listener = void 0;
var listener;

@@ -151,7 +145,8 @@ while (listeners.length) {

}
player.clearTimeout(monitor);
player.clearTimeout(waiting);
};
}; // creates and tracks a player listener if the player looks alive
// creates and tracks a player listener if the player looks alive
var healthcheck = function healthcheck(type, fn) {

@@ -171,9 +166,10 @@ var check = function check() {

return;
}
} // playback isn't expected if the player is paused
// playback isn't expected if the player is paused
if (player.paused()) {
return resetMonitor();
}
// playback isn't expected once the video has ended
} // playback isn't expected once the video has ended
if (player.ended()) {

@@ -193,11 +189,8 @@ return resetMonitor();

var lastTime = 0;
cleanup(); // if no playback is detected for long enough, trigger a timeout error
cleanup();
// if no playback is detected for long enough, trigger a timeout error
resetMonitor();
healthcheck(['timeupdate', 'adtimeupdate'], function () {
var currentTime = player.currentTime();
var currentTime = player.currentTime(); // playback is operating normally or has recovered
// playback is operating normally or has recovered
if (currentTime !== lastTime) {

@@ -208,6 +201,2 @@ lastTime = currentTime;

});
if (!options.progressDisabled) {
healthcheck('progress', resetMonitor);
}
};

@@ -228,6 +217,5 @@

var content = document.createElement('div');
var dialogContent = '';
var dialogContent = ''; // In the rare case when `error()` does not return an error object,
// defensively escape the handler function.
// In the rare case when `error()` does not return an error object,
// defensively escape the handler function.
if (!error) {

@@ -240,3 +228,3 @@ return;

if (error.message) {
details = '<div class="vjs-errors-details">' + player.localize('Technical details') + '\n : <div class="vjs-errors-message">' + player.localize(error.message) + '</div>\n </div>';
details = "<div class=\"vjs-errors-details\">" + player.localize('Technical details') + "\n : <div class=\"vjs-errors-message\">" + player.localize(error.message) + "</div>\n </div>";
}

@@ -246,24 +234,18 @@

var flashMessage = player.localize('If you are using an older browser please try upgrading or installing Flash.');
details += '<span class="vjs-errors-flashmessage">' + flashMessage + '</span>';
details += "<span class=\"vjs-errors-flashmessage\">" + flashMessage + "</span>";
}
var display = player.getChild('errorDisplay');
content.className = 'vjs-errors-dialog';
content.id = 'vjs-errors-dialog';
dialogContent = '<div class="vjs-errors-content-container">\n <h2 class="vjs-errors-headline">' + this.localize(error.headline) + '</h2>\n <div><b>' + this.localize('Error Code') + '</b>: ' + (error.type || error.code) + '</div>\n ' + details + '\n </div>';
dialogContent = "<div class=\"vjs-errors-content-container\">\n <h2 class=\"vjs-errors-headline\">" + this.localize(error.headline) + "</h2>\n <div><b>" + this.localize('Error Code') + "</b>: " + (error.type || error.code) + "</div>\n " + details + "\n </div>";
var closeable = display.closeable(!('dismiss' in error) || error.dismiss); // We should get a close button
var closeable = display.closeable(!('dismiss' in error) || error.dismiss);
// We should get a close button
if (closeable) {
dialogContent += '<div class="vjs-errors-ok-button-container">\n <button class="vjs-errors-ok-button">' + this.localize('OK') + '</button>\n </div>';
dialogContent += "<div class=\"vjs-errors-ok-button-container\">\n <button class=\"vjs-errors-ok-button\">" + this.localize('OK') + "</button>\n </div>";
content.innerHTML = dialogContent;
display.fillWith(content);
// Get the close button inside the error display
display.fillWith(content); // Get the close button inside the error display
display.contentEl().firstChild.appendChild(display.getChild('closeButton').el());
var okButton = display.el().querySelector('.vjs-errors-ok-button');
player.on(okButton, 'click', function () {

@@ -288,3 +270,2 @@ display.close();

cleanup();
player.removeClass('vjs-errors');

@@ -305,7 +286,8 @@ player.off('play', onPlayStartMonitor);

};
reInitPlugin.getAll = function () {
return videojs.mergeOptions(options.errors);
};
}; // Get / set timeout value. Restart monitor if changed.
// Get / set timeout value. Restart monitor if changed.
reInitPlugin.timeout = function (timeout) {

@@ -315,4 +297,6 @@ if (typeof timeout === 'undefined') {

}
if (timeout !== options.timeout) {
options.timeout = timeout;
if (!player.paused()) {

@@ -322,9 +306,8 @@ onPlayStartMonitor();

}
};
}; // no-op API
// TODO: remove in a major version
reInitPlugin.disableProgress = function (disabled) {
options.progressDisabled = disabled;
onPlayStartMonitor();
};
reInitPlugin.disableProgress = function () {};
player.on('play', onPlayStartMonitor);

@@ -334,15 +317,12 @@ player.on('play', onPlayNoSource);

player.on(['aderror', 'error'], onErrorHandler);
player.ready(function () {
player.addClass('vjs-errors');
});
}); // if the plugin is re-initialised during playback, start the timeout handler.
// if the plugin is re-initialised during playback, start the timeout handler.
if (!player.paused()) {
onPlayStartMonitor();
}
} // Include the version number.
// Include the version number.
reInitPlugin.VERSION = version;
player.errors = reInitPlugin;

@@ -355,14 +335,12 @@ };

['extend', 'getAll', 'disableProgress'].forEach(function (k) {
['extend', 'getAll'].forEach(function (k) {
errors[k] = function () {
videojs.log.warn('The errors.' + k + '() method is not available until the plugin has been initialized!');
videojs.log.warn("The errors." + k + "() method is not available until the plugin has been initialized!");
};
});
}); // Include the version number.
// Include the version number.
errors.VERSION = version;
errors.VERSION = version; // Register the plugin with video.js.
// Register the plugin with video.js.
registerPlugin('errors', errors);
module.exports = errors;

@@ -1,14 +0,12 @@

/*! @name videojs-errors @version 4.1.3 @license Apache-2.0 */
/*! @name videojs-errors @version 4.2.0 @license Apache-2.0 */
import videojs from 'video.js';
import document from 'global/document';
var version = "4.1.3";
var version = "4.2.0";
var FlashObj = videojs.getComponent('Flash');
var defaultDismiss = !videojs.browser.IS_IPHONE;
var defaultDismiss = !videojs.browser.IS_IPHONE; // Video.js 5/6 cross-compatibility.
// Video.js 5/6 cross-compatibility.
var registerPlugin = videojs.registerPlugin || videojs.plugin;
var registerPlugin = videojs.registerPlugin || videojs.plugin; // Default options for the plugin.
// Default options for the plugin.
var defaults = {

@@ -20,3 +18,2 @@ header: '',

dismiss: defaultDismiss,
progressDisabled: false,
errors: {

@@ -71,11 +68,10 @@ '1': {

var initPlugin = function initPlugin(player, options) {
var monitor = void 0;
var waiting = void 0;
var isStalling = void 0;
var monitor;
var waiting;
var isStalling;
var listeners = [];
var updateErrors = function updateErrors(updates) {
options.errors = videojs.mergeOptions(options.errors, updates);
options.errors = videojs.mergeOptions(options.errors, updates); // Create `code`s from errors which don't have them (based on their keys).
// Create `code`s from errors which don't have them (based on their keys).
Object.keys(options.errors).forEach(function (k) {

@@ -88,17 +84,17 @@ var err = options.errors[k];

});
};
}; // Make sure we flesh out initially-provided errors.
// Make sure we flesh out initially-provided errors.
updateErrors();
// clears the previous monitor timeout and sets up a new one
updateErrors(); // clears the previous monitor timeout and sets up a new one
var resetMonitor = function resetMonitor() {
// at this point the player has recovered
player.clearTimeout(waiting);
if (isStalling) {
isStalling = false;
player.removeClass('vjs-waiting');
}
} // start the loading spinner if player has stalled
// start the loading spinner if player has stalled
waiting = player.setTimeout(function () {

@@ -114,3 +110,2 @@ // player already has an error

}, 1000);
player.clearTimeout(monitor);

@@ -128,14 +123,13 @@ monitor = player.setTimeout(function () {

});
}, options.timeout);
}, options.timeout); // clear out any existing player timeout
// playback has recovered
// clear out any existing player timeout
// playback has recovered
if (player.error() && player.error().code === -2) {
player.error(null);
}
};
}; // clear any previously registered listeners
// clear any previously registered listeners
var cleanup = function cleanup() {
var listener = void 0;
var listener;

@@ -146,7 +140,8 @@ while (listeners.length) {

}
player.clearTimeout(monitor);
player.clearTimeout(waiting);
};
}; // creates and tracks a player listener if the player looks alive
// creates and tracks a player listener if the player looks alive
var healthcheck = function healthcheck(type, fn) {

@@ -166,9 +161,10 @@ var check = function check() {

return;
}
} // playback isn't expected if the player is paused
// playback isn't expected if the player is paused
if (player.paused()) {
return resetMonitor();
}
// playback isn't expected once the video has ended
} // playback isn't expected once the video has ended
if (player.ended()) {

@@ -188,11 +184,8 @@ return resetMonitor();

var lastTime = 0;
cleanup(); // if no playback is detected for long enough, trigger a timeout error
cleanup();
// if no playback is detected for long enough, trigger a timeout error
resetMonitor();
healthcheck(['timeupdate', 'adtimeupdate'], function () {
var currentTime = player.currentTime();
var currentTime = player.currentTime(); // playback is operating normally or has recovered
// playback is operating normally or has recovered
if (currentTime !== lastTime) {

@@ -203,6 +196,2 @@ lastTime = currentTime;

});
if (!options.progressDisabled) {
healthcheck('progress', resetMonitor);
}
};

@@ -223,6 +212,5 @@

var content = document.createElement('div');
var dialogContent = '';
var dialogContent = ''; // In the rare case when `error()` does not return an error object,
// defensively escape the handler function.
// In the rare case when `error()` does not return an error object,
// defensively escape the handler function.
if (!error) {

@@ -235,3 +223,3 @@ return;

if (error.message) {
details = '<div class="vjs-errors-details">' + player.localize('Technical details') + '\n : <div class="vjs-errors-message">' + player.localize(error.message) + '</div>\n </div>';
details = "<div class=\"vjs-errors-details\">" + player.localize('Technical details') + "\n : <div class=\"vjs-errors-message\">" + player.localize(error.message) + "</div>\n </div>";
}

@@ -241,24 +229,18 @@

var flashMessage = player.localize('If you are using an older browser please try upgrading or installing Flash.');
details += '<span class="vjs-errors-flashmessage">' + flashMessage + '</span>';
details += "<span class=\"vjs-errors-flashmessage\">" + flashMessage + "</span>";
}
var display = player.getChild('errorDisplay');
content.className = 'vjs-errors-dialog';
content.id = 'vjs-errors-dialog';
dialogContent = '<div class="vjs-errors-content-container">\n <h2 class="vjs-errors-headline">' + this.localize(error.headline) + '</h2>\n <div><b>' + this.localize('Error Code') + '</b>: ' + (error.type || error.code) + '</div>\n ' + details + '\n </div>';
dialogContent = "<div class=\"vjs-errors-content-container\">\n <h2 class=\"vjs-errors-headline\">" + this.localize(error.headline) + "</h2>\n <div><b>" + this.localize('Error Code') + "</b>: " + (error.type || error.code) + "</div>\n " + details + "\n </div>";
var closeable = display.closeable(!('dismiss' in error) || error.dismiss); // We should get a close button
var closeable = display.closeable(!('dismiss' in error) || error.dismiss);
// We should get a close button
if (closeable) {
dialogContent += '<div class="vjs-errors-ok-button-container">\n <button class="vjs-errors-ok-button">' + this.localize('OK') + '</button>\n </div>';
dialogContent += "<div class=\"vjs-errors-ok-button-container\">\n <button class=\"vjs-errors-ok-button\">" + this.localize('OK') + "</button>\n </div>";
content.innerHTML = dialogContent;
display.fillWith(content);
// Get the close button inside the error display
display.fillWith(content); // Get the close button inside the error display
display.contentEl().firstChild.appendChild(display.getChild('closeButton').el());
var okButton = display.el().querySelector('.vjs-errors-ok-button');
player.on(okButton, 'click', function () {

@@ -283,3 +265,2 @@ display.close();

cleanup();
player.removeClass('vjs-errors');

@@ -300,7 +281,8 @@ player.off('play', onPlayStartMonitor);

};
reInitPlugin.getAll = function () {
return videojs.mergeOptions(options.errors);
};
}; // Get / set timeout value. Restart monitor if changed.
// Get / set timeout value. Restart monitor if changed.
reInitPlugin.timeout = function (timeout) {

@@ -310,4 +292,6 @@ if (typeof timeout === 'undefined') {

}
if (timeout !== options.timeout) {
options.timeout = timeout;
if (!player.paused()) {

@@ -317,9 +301,8 @@ onPlayStartMonitor();

}
};
}; // no-op API
// TODO: remove in a major version
reInitPlugin.disableProgress = function (disabled) {
options.progressDisabled = disabled;
onPlayStartMonitor();
};
reInitPlugin.disableProgress = function () {};
player.on('play', onPlayStartMonitor);

@@ -329,15 +312,12 @@ player.on('play', onPlayNoSource);

player.on(['aderror', 'error'], onErrorHandler);
player.ready(function () {
player.addClass('vjs-errors');
});
}); // if the plugin is re-initialised during playback, start the timeout handler.
// if the plugin is re-initialised during playback, start the timeout handler.
if (!player.paused()) {
onPlayStartMonitor();
}
} // Include the version number.
// Include the version number.
reInitPlugin.VERSION = version;
player.errors = reInitPlugin;

@@ -350,14 +330,12 @@ };

['extend', 'getAll', 'disableProgress'].forEach(function (k) {
['extend', 'getAll'].forEach(function (k) {
errors[k] = function () {
videojs.log.warn('The errors.' + k + '() method is not available until the plugin has been initialized!');
videojs.log.warn("The errors." + k + "() method is not available until the plugin has been initialized!");
};
});
}); // Include the version number.
// Include the version number.
errors.VERSION = version;
errors.VERSION = version; // Register the plugin with video.js.
// Register the plugin with video.js.
registerPlugin('errors', errors);
export default errors;

@@ -1,2 +0,2 @@

/*! @name videojs-errors @version 4.1.3 @license Apache-2.0 */
/*! @name videojs-errors @version 4.2.0 @license Apache-2.0 */
(function (global, factory) {

@@ -11,11 +11,9 @@ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('video.js'), require('global/document')) :

var version = "4.1.3";
var version = "4.2.0";
var FlashObj = videojs.getComponent('Flash');
var defaultDismiss = !videojs.browser.IS_IPHONE;
var defaultDismiss = !videojs.browser.IS_IPHONE; // Video.js 5/6 cross-compatibility.
// Video.js 5/6 cross-compatibility.
var registerPlugin = videojs.registerPlugin || videojs.plugin;
var registerPlugin = videojs.registerPlugin || videojs.plugin; // Default options for the plugin.
// Default options for the plugin.
var defaults = {

@@ -27,3 +25,2 @@ header: '',

dismiss: defaultDismiss,
progressDisabled: false,
errors: {

@@ -78,11 +75,10 @@ '1': {

var initPlugin = function initPlugin(player, options) {
var monitor = void 0;
var waiting = void 0;
var isStalling = void 0;
var monitor;
var waiting;
var isStalling;
var listeners = [];
var updateErrors = function updateErrors(updates) {
options.errors = videojs.mergeOptions(options.errors, updates);
options.errors = videojs.mergeOptions(options.errors, updates); // Create `code`s from errors which don't have them (based on their keys).
// Create `code`s from errors which don't have them (based on their keys).
Object.keys(options.errors).forEach(function (k) {

@@ -95,17 +91,17 @@ var err = options.errors[k];

});
};
}; // Make sure we flesh out initially-provided errors.
// Make sure we flesh out initially-provided errors.
updateErrors();
// clears the previous monitor timeout and sets up a new one
updateErrors(); // clears the previous monitor timeout and sets up a new one
var resetMonitor = function resetMonitor() {
// at this point the player has recovered
player.clearTimeout(waiting);
if (isStalling) {
isStalling = false;
player.removeClass('vjs-waiting');
}
} // start the loading spinner if player has stalled
// start the loading spinner if player has stalled
waiting = player.setTimeout(function () {

@@ -121,3 +117,2 @@ // player already has an error

}, 1000);
player.clearTimeout(monitor);

@@ -135,14 +130,13 @@ monitor = player.setTimeout(function () {

});
}, options.timeout);
}, options.timeout); // clear out any existing player timeout
// playback has recovered
// clear out any existing player timeout
// playback has recovered
if (player.error() && player.error().code === -2) {
player.error(null);
}
};
}; // clear any previously registered listeners
// clear any previously registered listeners
var cleanup = function cleanup() {
var listener = void 0;
var listener;

@@ -153,7 +147,8 @@ while (listeners.length) {

}
player.clearTimeout(monitor);
player.clearTimeout(waiting);
};
}; // creates and tracks a player listener if the player looks alive
// creates and tracks a player listener if the player looks alive
var healthcheck = function healthcheck(type, fn) {

@@ -173,9 +168,10 @@ var check = function check() {

return;
}
} // playback isn't expected if the player is paused
// playback isn't expected if the player is paused
if (player.paused()) {
return resetMonitor();
}
// playback isn't expected once the video has ended
} // playback isn't expected once the video has ended
if (player.ended()) {

@@ -195,11 +191,8 @@ return resetMonitor();

var lastTime = 0;
cleanup(); // if no playback is detected for long enough, trigger a timeout error
cleanup();
// if no playback is detected for long enough, trigger a timeout error
resetMonitor();
healthcheck(['timeupdate', 'adtimeupdate'], function () {
var currentTime = player.currentTime();
var currentTime = player.currentTime(); // playback is operating normally or has recovered
// playback is operating normally or has recovered
if (currentTime !== lastTime) {

@@ -210,6 +203,2 @@ lastTime = currentTime;

});
if (!options.progressDisabled) {
healthcheck('progress', resetMonitor);
}
};

@@ -230,6 +219,5 @@

var content = document.createElement('div');
var dialogContent = '';
var dialogContent = ''; // In the rare case when `error()` does not return an error object,
// defensively escape the handler function.
// In the rare case when `error()` does not return an error object,
// defensively escape the handler function.
if (!error) {

@@ -242,3 +230,3 @@ return;

if (error.message) {
details = '<div class="vjs-errors-details">' + player.localize('Technical details') + '\n : <div class="vjs-errors-message">' + player.localize(error.message) + '</div>\n </div>';
details = "<div class=\"vjs-errors-details\">" + player.localize('Technical details') + "\n : <div class=\"vjs-errors-message\">" + player.localize(error.message) + "</div>\n </div>";
}

@@ -248,24 +236,18 @@

var flashMessage = player.localize('If you are using an older browser please try upgrading or installing Flash.');
details += '<span class="vjs-errors-flashmessage">' + flashMessage + '</span>';
details += "<span class=\"vjs-errors-flashmessage\">" + flashMessage + "</span>";
}
var display = player.getChild('errorDisplay');
content.className = 'vjs-errors-dialog';
content.id = 'vjs-errors-dialog';
dialogContent = '<div class="vjs-errors-content-container">\n <h2 class="vjs-errors-headline">' + this.localize(error.headline) + '</h2>\n <div><b>' + this.localize('Error Code') + '</b>: ' + (error.type || error.code) + '</div>\n ' + details + '\n </div>';
dialogContent = "<div class=\"vjs-errors-content-container\">\n <h2 class=\"vjs-errors-headline\">" + this.localize(error.headline) + "</h2>\n <div><b>" + this.localize('Error Code') + "</b>: " + (error.type || error.code) + "</div>\n " + details + "\n </div>";
var closeable = display.closeable(!('dismiss' in error) || error.dismiss); // We should get a close button
var closeable = display.closeable(!('dismiss' in error) || error.dismiss);
// We should get a close button
if (closeable) {
dialogContent += '<div class="vjs-errors-ok-button-container">\n <button class="vjs-errors-ok-button">' + this.localize('OK') + '</button>\n </div>';
dialogContent += "<div class=\"vjs-errors-ok-button-container\">\n <button class=\"vjs-errors-ok-button\">" + this.localize('OK') + "</button>\n </div>";
content.innerHTML = dialogContent;
display.fillWith(content);
// Get the close button inside the error display
display.fillWith(content); // Get the close button inside the error display
display.contentEl().firstChild.appendChild(display.getChild('closeButton').el());
var okButton = display.el().querySelector('.vjs-errors-ok-button');
player.on(okButton, 'click', function () {

@@ -290,3 +272,2 @@ display.close();

cleanup();
player.removeClass('vjs-errors');

@@ -307,7 +288,8 @@ player.off('play', onPlayStartMonitor);

};
reInitPlugin.getAll = function () {
return videojs.mergeOptions(options.errors);
};
}; // Get / set timeout value. Restart monitor if changed.
// Get / set timeout value. Restart monitor if changed.
reInitPlugin.timeout = function (timeout) {

@@ -317,4 +299,6 @@ if (typeof timeout === 'undefined') {

}
if (timeout !== options.timeout) {
options.timeout = timeout;
if (!player.paused()) {

@@ -324,9 +308,8 @@ onPlayStartMonitor();

}
};
}; // no-op API
// TODO: remove in a major version
reInitPlugin.disableProgress = function (disabled) {
options.progressDisabled = disabled;
onPlayStartMonitor();
};
reInitPlugin.disableProgress = function () {};
player.on('play', onPlayStartMonitor);

@@ -336,15 +319,12 @@ player.on('play', onPlayNoSource);

player.on(['aderror', 'error'], onErrorHandler);
player.ready(function () {
player.addClass('vjs-errors');
});
}); // if the plugin is re-initialised during playback, start the timeout handler.
// if the plugin is re-initialised during playback, start the timeout handler.
if (!player.paused()) {
onPlayStartMonitor();
}
} // Include the version number.
// Include the version number.
reInitPlugin.VERSION = version;
player.errors = reInitPlugin;

@@ -357,12 +337,10 @@ };

['extend', 'getAll', 'disableProgress'].forEach(function (k) {
['extend', 'getAll'].forEach(function (k) {
errors[k] = function () {
videojs.log.warn('The errors.' + k + '() method is not available until the plugin has been initialized!');
videojs.log.warn("The errors." + k + "() method is not available until the plugin has been initialized!");
};
});
}); // Include the version number.
// Include the version number.
errors.VERSION = version;
errors.VERSION = version; // Register the plugin with video.js.
// Register the plugin with video.js.
registerPlugin('errors', errors);

@@ -369,0 +347,0 @@

@@ -1,2 +0,2 @@

/*! @name videojs-errors @version 4.1.3 @license Apache-2.0 */
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r(require("video.js"),require("global/document")):"function"==typeof define&&define.amd?define(["video.js","global/document"],r):e.videojsErrors=r(e.videojs,e.document)}(this,function(e,r){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e,r=r&&r.hasOwnProperty("default")?r.default:r;var o=e.getComponent("Flash"),i=!e.browser.IS_IPHONE,n=e.registerPlugin||e.plugin,t={header:"",code:"",message:"",timeout:45e3,dismiss:i,progressDisabled:!1,errors:{1:{type:"MEDIA_ERR_ABORTED",headline:"The video download was cancelled"},2:{type:"MEDIA_ERR_NETWORK",headline:"The video connection was lost, please confirm you are connected to the internet"},3:{type:"MEDIA_ERR_DECODE",headline:"The video is bad or in a format that cannot be played on your browser"},4:{type:"MEDIA_ERR_SRC_NOT_SUPPORTED",headline:"This video is either unavailable or not supported in this browser"},5:{type:"MEDIA_ERR_ENCRYPTED",headline:"The video you are trying to watch is encrypted and we do not know how to decrypt it"},unknown:{type:"MEDIA_ERR_UNKNOWN",headline:"An unanticipated problem was encountered, check back soon and try again"},"-1":{type:"PLAYER_ERR_NO_SRC",headline:"No video has been loaded"},"-2":{type:"PLAYER_ERR_TIMEOUT",headline:"Could not download the video"},PLAYER_ERR_DOMAIN_RESTRICTED:{headline:"This video is restricted from playing on your current domain"},PLAYER_ERR_IP_RESTRICTED:{headline:"This video is restricted at your current IP address"},PLAYER_ERR_GEO_RESTRICTED:{headline:"This video is restricted from playing in your current geographic region"},FLASHLS_ERR_CROSS_DOMAIN:{headline:"The video could not be loaded: crossdomain access denied."}}},s=function(i){!function i(n,s){var a=void 0,d=void 0,l=void 0,c=[],u=function(r){s.errors=e.mergeOptions(s.errors,r),Object.keys(s.errors).forEach(function(e){var r=s.errors[e];r.type||(r.type=e)})};u();var p=function(){n.clearTimeout(d),l&&(l=!1,n.removeClass("vjs-waiting")),d=n.setTimeout(function(){n.error()||n.paused()||n.ended()||(l=!0,n.addClass("vjs-waiting"))},1e3),n.clearTimeout(a),a=n.setTimeout(function(){n.error()||n.paused()||n.ended()||n.error({code:-2,type:"PLAYER_ERR_TIMEOUT"})},s.timeout),n.error()&&-2===n.error().code&&n.error(null)},f=function(){for(var e=void 0;c.length;)e=c.shift(),n.off(e[0],e[1]);n.clearTimeout(a),n.clearTimeout(d)},h=function(e,r){var o=function(){if(!n.error()){var e=n.$(".vjs-tech");if(e&&"application/x-shockwave-flash"===e.type&&!e.vjs_getProperty)return void n.error({code:-2,type:"PLAYER_ERR_TIMEOUT"});if(n.paused())return p();if(n.ended())return p()}r.call(this)};n.on(e,o),c.push([e,o])},v=function(){var e=0;f(),p(),h(["timeupdate","adtimeupdate"],function(){var r=n.currentTime();r!==e&&(e=r,p())}),s.progressDisabled||h("progress",p)},E=function(){n.currentSrc()||n.error({code:-1,type:"PLAYER_ERR_NO_SRC"})},R=function(){var i="",t=n.error(),a=r.createElement("div"),d="";if(t){(t=e.mergeOptions(t,s.errors[t.code||t.type||0])).message&&(i='<div class="vjs-errors-details">'+n.localize("Technical details")+'\n : <div class="vjs-errors-message">'+n.localize(t.message)+"</div>\n </div>"),4===t.code&&o&&!o.isSupported()&&(i+='<span class="vjs-errors-flashmessage">'+n.localize("If you are using an older browser please try upgrading or installing Flash.")+"</span>");var l=n.getChild("errorDisplay");if(a.className="vjs-errors-dialog",a.id="vjs-errors-dialog",d='<div class="vjs-errors-content-container">\n <h2 class="vjs-errors-headline">'+this.localize(t.headline)+"</h2>\n <div><b>"+this.localize("Error Code")+"</b>: "+(t.type||t.code)+"</div>\n "+i+"\n </div>",l.closeable(!("dismiss"in t)||t.dismiss)){d+='<div class="vjs-errors-ok-button-container">\n <button class="vjs-errors-ok-button">'+this.localize("OK")+"</button>\n </div>",a.innerHTML=d,l.fillWith(a),l.contentEl().firstChild.appendChild(l.getChild("closeButton").el());var c=l.el().querySelector(".vjs-errors-ok-button");n.on(c,"click",function(){l.close()})}else a.innerHTML=d,l.fillWith(a);(n.currentWidth()<=600||n.currentHeight()<=250)&&l.addClass("vjs-xs"),l.one("modalclose",function(){return n.error(null)})}},m=function e(){f(),n.removeClass("vjs-errors"),n.off("play",v),n.off("play",E),n.off("dispose",e),n.off(["aderror","error"],R)},g=function(r){m(),i(n,e.mergeOptions(t,r))};g.extend=function(e){return u(e)},g.getAll=function(){return e.mergeOptions(s.errors)},g.timeout=function(e){if(void 0===e)return s.timeout;e!==s.timeout&&(s.timeout=e,n.paused()||v())},g.disableProgress=function(e){s.progressDisabled=e,v()},n.on("play",v),n.on("play",E),n.on("dispose",m),n.on(["aderror","error"],R),n.ready(function(){n.addClass("vjs-errors")}),n.paused()||v(),g.VERSION="4.1.3",n.errors=g}(this,e.mergeOptions(t,i))};return["extend","getAll","disableProgress"].forEach(function(r){s[r]=function(){e.log.warn("The errors."+r+"() method is not available until the plugin has been initialized!")}}),s.VERSION="4.1.3",n("errors",s),s});
/*! @name videojs-errors @version 4.2.0 @license Apache-2.0 */
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r(require("video.js"),require("global/document")):"function"==typeof define&&define.amd?define(["video.js","global/document"],r):e.videojsErrors=r(e.videojs,e.document)}(this,function(e,r){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e,r=r&&r.hasOwnProperty("default")?r.default:r;var o=e.getComponent("Flash"),n=!e.browser.IS_IPHONE,i=e.registerPlugin||e.plugin,t={header:"",code:"",message:"",timeout:45e3,dismiss:n,errors:{1:{type:"MEDIA_ERR_ABORTED",headline:"The video download was cancelled"},2:{type:"MEDIA_ERR_NETWORK",headline:"The video connection was lost, please confirm you are connected to the internet"},3:{type:"MEDIA_ERR_DECODE",headline:"The video is bad or in a format that cannot be played on your browser"},4:{type:"MEDIA_ERR_SRC_NOT_SUPPORTED",headline:"This video is either unavailable or not supported in this browser"},5:{type:"MEDIA_ERR_ENCRYPTED",headline:"The video you are trying to watch is encrypted and we do not know how to decrypt it"},unknown:{type:"MEDIA_ERR_UNKNOWN",headline:"An unanticipated problem was encountered, check back soon and try again"},"-1":{type:"PLAYER_ERR_NO_SRC",headline:"No video has been loaded"},"-2":{type:"PLAYER_ERR_TIMEOUT",headline:"Could not download the video"},PLAYER_ERR_DOMAIN_RESTRICTED:{headline:"This video is restricted from playing on your current domain"},PLAYER_ERR_IP_RESTRICTED:{headline:"This video is restricted at your current IP address"},PLAYER_ERR_GEO_RESTRICTED:{headline:"This video is restricted from playing in your current geographic region"},FLASHLS_ERR_CROSS_DOMAIN:{headline:"The video could not be loaded: crossdomain access denied."}}},s=function n(i,s){var a,d,l,c=[],u=function(r){s.errors=e.mergeOptions(s.errors,r),Object.keys(s.errors).forEach(function(e){var r=s.errors[e];r.type||(r.type=e)})};u();var f=function(){i.clearTimeout(d),l&&(l=!1,i.removeClass("vjs-waiting")),d=i.setTimeout(function(){i.error()||i.paused()||i.ended()||(l=!0,i.addClass("vjs-waiting"))},1e3),i.clearTimeout(a),a=i.setTimeout(function(){i.error()||i.paused()||i.ended()||i.error({code:-2,type:"PLAYER_ERR_TIMEOUT"})},s.timeout),i.error()&&-2===i.error().code&&i.error(null)},h=function(){for(var e;c.length;)e=c.shift(),i.off(e[0],e[1]);i.clearTimeout(a),i.clearTimeout(d)},p=function(){var e,r,o,n=0;h(),f(),e=["timeupdate","adtimeupdate"],r=function(){var e=i.currentTime();e!==n&&(n=e,f())},o=function(){if(!i.error()){var e=i.$(".vjs-tech");if(e&&"application/x-shockwave-flash"===e.type&&!e.vjs_getProperty)return void i.error({code:-2,type:"PLAYER_ERR_TIMEOUT"});if(i.paused())return f();if(i.ended())return f()}r.call(this)},i.on(e,o),c.push([e,o])},v=function(){i.currentSrc()||i.error({code:-1,type:"PLAYER_ERR_NO_SRC"})},E=function(){var n="",t=i.error(),a=r.createElement("div"),d="";if(t){if((t=e.mergeOptions(t,s.errors[t.code||t.type||0])).message&&(n='<div class="vjs-errors-details">'+i.localize("Technical details")+'\n : <div class="vjs-errors-message">'+i.localize(t.message)+"</div>\n </div>"),4===t.code&&o&&!o.isSupported())n+='<span class="vjs-errors-flashmessage">'+i.localize("If you are using an older browser please try upgrading or installing Flash.")+"</span>";var l=i.getChild("errorDisplay");if(a.className="vjs-errors-dialog",a.id="vjs-errors-dialog",d='<div class="vjs-errors-content-container">\n <h2 class="vjs-errors-headline">'+this.localize(t.headline)+"</h2>\n <div><b>"+this.localize("Error Code")+"</b>: "+(t.type||t.code)+"</div>\n "+n+"\n </div>",l.closeable(!("dismiss"in t)||t.dismiss)){d+='<div class="vjs-errors-ok-button-container">\n <button class="vjs-errors-ok-button">'+this.localize("OK")+"</button>\n </div>",a.innerHTML=d,l.fillWith(a),l.contentEl().firstChild.appendChild(l.getChild("closeButton").el());var c=l.el().querySelector(".vjs-errors-ok-button");i.on(c,"click",function(){l.close()})}else a.innerHTML=d,l.fillWith(a);(i.currentWidth()<=600||i.currentHeight()<=250)&&l.addClass("vjs-xs"),l.one("modalclose",function(){return i.error(null)})}},R=function e(){h(),i.removeClass("vjs-errors"),i.off("play",p),i.off("play",v),i.off("dispose",e),i.off(["aderror","error"],E)},m=function(r){R(),n(i,e.mergeOptions(t,r))};m.extend=function(e){return u(e)},m.getAll=function(){return e.mergeOptions(s.errors)},m.timeout=function(e){if(void 0===e)return s.timeout;e!==s.timeout&&(s.timeout=e,i.paused()||p())},m.disableProgress=function(){},i.on("play",p),i.on("play",v),i.on("dispose",R),i.on(["aderror","error"],E),i.ready(function(){i.addClass("vjs-errors")}),i.paused()||p(),m.VERSION="4.2.0",i.errors=m},a=function(r){s(this,e.mergeOptions(t,r))};return["extend","getAll"].forEach(function(r){a[r]=function(){e.log.warn("The errors."+r+"() method is not available until the plugin has been initialized!")}}),a.VERSION="4.2.0",i("errors",a),a});
{
"name": "videojs-errors",
"version": "4.1.3",
"version": "4.2.0",
"author": "Brightcove, Inc.",

@@ -18,3 +18,3 @@ "description": "A Video.js plugin for custom error reporting",

"generator-videojs-plugin": {
"version": "7.0.2"
"version": "7.3.2"
},

@@ -30,6 +30,6 @@ "scripts": {

"docs": "npm-run-all docs:*",
"docs:api": "jsdoc src -g plugins/markdown -r -c scripts/jsdoc.json -d docs/api",
"docs:api": "jsdoc src -g plugins/markdown -r -d docs/api",
"docs:toc": "doctoc README.md",
"lint": "vjsstandard",
"server": "karma start scripts/karma.conf.js --singleRun=false --auto-watch --no-browsers",
"server": "karma start scripts/karma.conf.js --singleRun=false --auto-watch",
"start": "npm-run-all -p server watch",

@@ -44,4 +44,4 @@ "pretest": "npm-run-all lint build",

"watch:js": "npm run build:js -- -w",
"prepublish": "not-in-install && npm run build || in-install",
"precommit": "lint-staged"
"posttest": "shx cat test/dist/coverage/text.txt",
"prepublishOnly": "npm run build && vjsverify"
},

@@ -72,4 +72,3 @@ "vjsstandard": {

"doctoc": "^1.3.1",
"husky": "^0.14.3",
"in-publish": "^2.0.0",
"husky": "^1.0.0-rc.13",
"jsdoc": "https://github.com/BrandonOCasey/jsdoc#feat/plugin-from-cli",

@@ -82,10 +81,13 @@ "karma": "^3.0.0",

"postcss-cli": "^6.0.0",
"rollup": "^0.64.1",
"rollup": "^0.66.0",
"shx": "^0.3.2",
"sinon": "^6.1.5",
"videojs-generate-karma-config": "~1.0.1",
"videojs-generate-karma-config": "~3.0.0",
"videojs-generate-postcss-config": "~2.0.1",
"videojs-generate-rollup-config": "~1.0.0",
"videojs-generate-rollup-config": "~2.2.0",
"videojs-languages": "^1.0.0",
"videojs-standard": "^7.0.1"
"videojs-standard": "~7.1.0",
"pkg-ok": "^2.2.0",
"npm-merge-driver-install": "^1.0.0",
"videojs-generator-verify": "~1.0.3"
},

@@ -105,3 +107,8 @@ "browserslist": [

]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
}
}
const generate = require('videojs-generate-karma-config');
module.exports = function(config) {
config = generate(config);
// any custom stuff here!
// see https://github.com/videojs/videojs-generate-karma-config
// for options
const options = {};
config = generate(config, options);
// any other custom stuff not supported by options here!
};

@@ -18,3 +18,2 @@ import videojs from 'video.js';

dismiss: defaultDismiss,
progressDisabled: false,
errors: {

@@ -198,6 +197,2 @@ '1': {

});
if (!options.progressDisabled) {
healthcheck('progress', resetMonitor);
}
};

@@ -314,6 +309,5 @@

reInitPlugin.disableProgress = function(disabled) {
options.progressDisabled = disabled;
onPlayStartMonitor();
};
// no-op API
// TODO: remove in a major version
reInitPlugin.disableProgress = () => {};

@@ -344,3 +338,3 @@ player.on('play', onPlayStartMonitor);

['extend', 'getAll', 'disableProgress'].forEach(k => {
['extend', 'getAll'].forEach(k => {
errors[k] = function() {

@@ -347,0 +341,0 @@ videojs.log.warn(

@@ -141,7 +141,5 @@ import document from 'global/document';

QUnit.test('when progress watching is disabled, progress within 45 seconds is an error', function(assert) {
QUnit.test('progress events are ignored during timeout', function(assert) {
let errors = 0;
this.player.errors.disableProgress(true);
this.player.on('error', function() {

@@ -159,4 +157,2 @@ errors++;

assert.strictEqual(this.player.error().type, 'PLAYER_ERR_TIMEOUT');
this.player.errors.disableProgress(false);
});

@@ -222,3 +218,3 @@

QUnit.test('progress clears player timeout errors', function(assert) {
QUnit.test('progress does not clear player timeout errors', function(assert) {
let errors = 0;

@@ -239,3 +235,3 @@

this.player.trigger('progress');
assert.strictEqual(this.player.error(), null, 'error removed');
assert.strictEqual(this.player.error().code, -2, 'error code is -2');
});

@@ -315,19 +311,2 @@

QUnit.test('progress events while playing reset the player timeout', function(assert) {
let errors = 0;
this.player.on('error', function() {
errors++;
});
this.player.src(sources);
this.player.trigger('play');
// stalled for awhile
this.clock.tick(44 * 1000);
// but playback resumes!
this.player.trigger('progress');
this.clock.tick(44 * 1000);
assert.strictEqual(errors, 0, 'no errors emitted');
});
QUnit.test('no signs of playback triggers a player timeout', function(assert) {

@@ -334,0 +313,0 @@ let errors = 0;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc