Socket
Socket
Sign inDemoInstall

videojs-errors

Package Overview
Dependencies
Maintainers
5
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 0.1.8 to 1.0.0

85

dist/videojs-errors.js

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

/*! videojs-errors - v0.1.8 - 2015-05-05
/*! videojs-errors - v1.0.0 - 2015-11-23
* Copyright (c) 2015 Brightcove; Licensed Apache-2.0 */

@@ -52,3 +52,3 @@ (function(){

var
settings = videojs.util.mergeOptions(defaults, options),
settings = videojs.mergeOptions(defaults, options),

@@ -138,3 +138,2 @@ monitor,

var initCustomErrorConditions = function(player, options) {
var stalledTimeout, playbackMonitor;

@@ -158,50 +157,60 @@ // PLAYER_ERR_TIMEOUT

videojs.plugin('errors', function(options){
var
player = this,
// Merge the external and default settings
settings = videojs.util.mergeOptions(defaults, options);
settings = videojs.mergeOptions(defaults, options);
// Add to the error dialog when an error occurs
this.on('error', function() {
var code, error, display, details = '';
player.ready(function() {
error = videojs.util.mergeOptions(this.error(), settings.errors[this.error().code || 0]);
// Add to the error dialog when an error occurs
this.on('error', function() {
var code, error, display, details = '';
if (error.message) {
details = '<div class="vjs-errors-details">' + this.localize('Technical details') +
': <div class="vjs-errors-message">' + this.localize(error.message) + '</div>' +
'</div>';
}
error = this.error();
display = this.errorDisplay;
// In the rare case when `error()` does not return an error object,
// defensively escape the handler function.
if (!error) {
return;
}
display.el().innerHTML =
'<div class="vjs-errors-dialog">' +
'<button class="vjs-errors-close-button"></button>' +
'<div class="vjs-errors-content-container">' +
'<h2 class="vjs-errors-headline">' + this.localize(error.headline) + '</h2>' +
'<div><b>' + this.localize('Error Code') + '</b>: ' + (error.type || error.code) + '</div>' +
this.localize(details) +
'</div>' +
'<div class="vjs-errors-ok-button-container">' +
'<button class="vjs-errors-ok-button">' + this.localize('OK') + '</button>' +
'</div>' +
'</div>';
error = videojs.mergeOptions(error, settings.errors[error.code || 0]);
if (player.width() <= 600 || player.height() <= 250) {
display.addClass('vjs-xs');
}
if (error.message) {
details = '<div class="vjs-errors-details">' + this.localize('Technical details') +
': <div class="vjs-errors-message">' + this.localize(error.message) + '</div>' +
'</div>';
}
on(display.el().querySelector('.vjs-errors-close-button'), 'click', function() {
display.hide();
display = this.errorDisplay;
display.el().innerHTML =
'<div class="vjs-errors-dialog">' +
'<button class="vjs-errors-close-button"></button>' +
'<div class="vjs-errors-content-container">' +
'<h2 class="vjs-errors-headline">' + this.localize(error.headline) + '</h2>' +
'<div><b>' + this.localize('Error Code') + '</b>: ' + (error.type || error.code) + '</div>' +
this.localize(details) +
'</div>' +
'<div class="vjs-errors-ok-button-container">' +
'<button class="vjs-errors-ok-button">' + this.localize('OK') + '</button>' +
'</div>' +
'</div>';
if (player.width() <= 600 || player.height() <= 250) {
display.addClass('vjs-xs');
}
on(display.el().querySelector('.vjs-errors-close-button'), 'click', function() {
display.hide();
});
on(display.el().querySelector('.vjs-errors-ok-button'), 'click', function() {
display.hide();
});
});
on(display.el().querySelector('.vjs-errors-ok-button'), 'click', function() {
display.hide();
});
// Initialize custom error conditions
initCustomErrorConditions(this, settings);
});
// Initialize custom error conditions
initCustomErrorConditions(this, settings);
});
})();

@@ -1,3 +0,3 @@

/*! videojs-errors - v0.1.8 - 2015-05-05
/*! videojs-errors - v1.0.0 - 2015-11-23
* Copyright (c) 2015 Brightcove; Licensed Apache-2.0 */
!function(){var a={header:"",code:"",message:"",timeout:45e3,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"}}},b=function(b,c){var d,e=videojs.util.mergeOptions(a,c),f=function(){window.clearTimeout(d),d=window.setTimeout(function(){b.error()||b.paused()||b.ended()||b.error({code:-2,type:"PLAYER_ERR_TIMEOUT"})},e.timeout),b.error()&&-2===b.error().code&&b.error(null)},g=[],h=function(a,c){var d=function(){return b.paused()?i():b.ended()?i():void c.call(this)};b.on(a,d),g.push([a,d])},i=function(){for(var a;g.length;)a=g.shift(),b.off(a[0],a[1]);window.clearTimeout(d)};b.on("play",function(){var a=0;i(),f(),h("timeupdate",function(){var c=b.currentTime();c!==a&&(a=c,f())}),h("progress",f)}),b.on("dispose",function(){i()})},c=function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c)},d=function(a,c){b(a,c),a.on("play",function(){(null===a.currentSrc()||void 0===a.currentSrc()||""===a.currentSrc())&&a.error({code:-1,type:"PLAYER_ERR_NO_SRC"})})};videojs.plugin("errors",function(b){var e=this,f=videojs.util.mergeOptions(a,b);this.on("error",function(){var a,b,d="";a=videojs.util.mergeOptions(this.error(),f.errors[this.error().code||0]),a.message&&(d='<div class="vjs-errors-details">'+this.localize("Technical details")+': <div class="vjs-errors-message">'+this.localize(a.message)+"</div></div>"),b=this.errorDisplay,b.el().innerHTML='<div class="vjs-errors-dialog"><button class="vjs-errors-close-button"></button><div class="vjs-errors-content-container"><h2 class="vjs-errors-headline">'+this.localize(a.headline)+"</h2><div><b>"+this.localize("Error Code")+"</b>: "+(a.type||a.code)+"</div>"+this.localize(d)+'</div><div class="vjs-errors-ok-button-container"><button class="vjs-errors-ok-button">'+this.localize("OK")+"</button></div></div>",(e.width()<=600||e.height()<=250)&&b.addClass("vjs-xs"),c(b.el().querySelector(".vjs-errors-close-button"),"click",function(){b.hide()}),c(b.el().querySelector(".vjs-errors-ok-button"),"click",function(){b.hide()})}),d(this,f)})}();
!function(){var a={header:"",code:"",message:"",timeout:45e3,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"}}},b=function(b,c){var d,e=videojs.mergeOptions(a,c),f=function(){window.clearTimeout(d),d=window.setTimeout(function(){b.error()||b.paused()||b.ended()||b.error({code:-2,type:"PLAYER_ERR_TIMEOUT"})},e.timeout),b.error()&&-2===b.error().code&&b.error(null)},g=[],h=function(a,c){var d=function(){return b.paused()?i():b.ended()?i():void c.call(this)};b.on(a,d),g.push([a,d])},i=function(){for(var a;g.length;)a=g.shift(),b.off(a[0],a[1]);window.clearTimeout(d)};b.on("play",function(){var a=0;i(),f(),h("timeupdate",function(){var c=b.currentTime();c!==a&&(a=c,f())}),h("progress",f)}),b.on("dispose",function(){i()})},c=function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c)},d=function(a,c){b(a,c),a.on("play",function(){(null===a.currentSrc()||void 0===a.currentSrc()||""===a.currentSrc())&&a.error({code:-1,type:"PLAYER_ERR_NO_SRC"})})};videojs.plugin("errors",function(b){var e=this,f=videojs.mergeOptions(a,b);e.ready(function(){this.on("error",function(){var a,b,d="";a=this.error(),a&&(a=videojs.mergeOptions(a,f.errors[a.code||0]),a.message&&(d='<div class="vjs-errors-details">'+this.localize("Technical details")+': <div class="vjs-errors-message">'+this.localize(a.message)+"</div></div>"),b=this.errorDisplay,b.el().innerHTML='<div class="vjs-errors-dialog"><button class="vjs-errors-close-button"></button><div class="vjs-errors-content-container"><h2 class="vjs-errors-headline">'+this.localize(a.headline)+"</h2><div><b>"+this.localize("Error Code")+"</b>: "+(a.type||a.code)+"</div>"+this.localize(d)+'</div><div class="vjs-errors-ok-button-container"><button class="vjs-errors-ok-button">'+this.localize("OK")+"</button></div></div>",(e.width()<=600||e.height()<=250)&&b.addClass("vjs-xs"),c(b.el().querySelector(".vjs-errors-close-button"),"click",function(){b.hide()}),c(b.el().querySelector(".vjs-errors-ok-button"),"click",function(){b.hide()}))}),d(this,f)})})}();

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

Copyright 2013 Brightcove, Inc.
Copyright 2015 Brightcove, Inc.

@@ -3,0 +3,0 @@ Licensed under the Apache License, Version 2.0 (the "License");

{
"name": "videojs-errors",
"version": "0.1.8",
"version": "1.0.0",
"author": "Brightcove",

@@ -19,3 +19,5 @@ "description": "A VideoJS plugin for custom error reporting",

"scripts": {
"test": "grunt test"
"test": "grunt test",
"version": "grunt && git add dist",
"postversion": "git push && git push --tags"
},

@@ -25,15 +27,15 @@ "dependencies": {},

"grunt": "^0.4.4",
"grunt-contrib-clean": "^0.4",
"grunt-contrib-concat": "^0.3",
"grunt-contrib-connect": "^0.7",
"grunt-contrib-jshint": "^0.6",
"grunt-contrib-qunit": "^0.2",
"grunt-contrib-uglify": "^0.2",
"grunt-contrib-watch": "^0.4",
"grunt-videojs-languages": "0.0.4",
"load-grunt-tasks": "0.6.0",
"qunitjs": "^1.12",
"grunt-contrib-clean": "^0.4.0",
"grunt-contrib-concat": "^0.3.0",
"grunt-contrib-connect": "^0.7.0",
"grunt-contrib-jshint": "^0.6.0",
"grunt-contrib-qunit": "^0.2.0",
"grunt-contrib-uglify": "^0.2.0",
"grunt-contrib-watch": "^0.4.0",
"grunt-videojs-languages": "^0.0.4",
"load-grunt-tasks": "^0.6.0",
"qunitjs": "^1.12.0",
"sinon": "^1.14.1",
"video.js": "^4.12.5"
"video.js": "^5.2.1"
}
}

@@ -50,3 +50,3 @@ (function(){

var
settings = videojs.util.mergeOptions(defaults, options),
settings = videojs.mergeOptions(defaults, options),

@@ -136,3 +136,2 @@ monitor,

var initCustomErrorConditions = function(player, options) {
var stalledTimeout, playbackMonitor;

@@ -156,50 +155,60 @@ // PLAYER_ERR_TIMEOUT

videojs.plugin('errors', function(options){
var
player = this,
// Merge the external and default settings
settings = videojs.util.mergeOptions(defaults, options);
settings = videojs.mergeOptions(defaults, options);
// Add to the error dialog when an error occurs
this.on('error', function() {
var code, error, display, details = '';
player.ready(function() {
error = videojs.util.mergeOptions(this.error(), settings.errors[this.error().code || 0]);
// Add to the error dialog when an error occurs
this.on('error', function() {
var code, error, display, details = '';
if (error.message) {
details = '<div class="vjs-errors-details">' + this.localize('Technical details') +
': <div class="vjs-errors-message">' + this.localize(error.message) + '</div>' +
'</div>';
}
error = this.error();
display = this.errorDisplay;
// In the rare case when `error()` does not return an error object,
// defensively escape the handler function.
if (!error) {
return;
}
display.el().innerHTML =
'<div class="vjs-errors-dialog">' +
'<button class="vjs-errors-close-button"></button>' +
'<div class="vjs-errors-content-container">' +
'<h2 class="vjs-errors-headline">' + this.localize(error.headline) + '</h2>' +
'<div><b>' + this.localize('Error Code') + '</b>: ' + (error.type || error.code) + '</div>' +
this.localize(details) +
'</div>' +
'<div class="vjs-errors-ok-button-container">' +
'<button class="vjs-errors-ok-button">' + this.localize('OK') + '</button>' +
'</div>' +
'</div>';
error = videojs.mergeOptions(error, settings.errors[error.code || 0]);
if (player.width() <= 600 || player.height() <= 250) {
display.addClass('vjs-xs');
}
if (error.message) {
details = '<div class="vjs-errors-details">' + this.localize('Technical details') +
': <div class="vjs-errors-message">' + this.localize(error.message) + '</div>' +
'</div>';
}
on(display.el().querySelector('.vjs-errors-close-button'), 'click', function() {
display.hide();
display = this.errorDisplay;
display.el().innerHTML =
'<div class="vjs-errors-dialog">' +
'<button class="vjs-errors-close-button"></button>' +
'<div class="vjs-errors-content-container">' +
'<h2 class="vjs-errors-headline">' + this.localize(error.headline) + '</h2>' +
'<div><b>' + this.localize('Error Code') + '</b>: ' + (error.type || error.code) + '</div>' +
this.localize(details) +
'</div>' +
'<div class="vjs-errors-ok-button-container">' +
'<button class="vjs-errors-ok-button">' + this.localize('OK') + '</button>' +
'</div>' +
'</div>';
if (player.width() <= 600 || player.height() <= 250) {
display.addClass('vjs-xs');
}
on(display.el().querySelector('.vjs-errors-close-button'), 'click', function() {
display.hide();
});
on(display.el().querySelector('.vjs-errors-ok-button'), 'click', function() {
display.hide();
});
});
on(display.el().querySelector('.vjs-errors-ok-button'), 'click', function() {
display.hide();
});
// Initialize custom error conditions
initCustomErrorConditions(this, settings);
});
// Initialize custom error conditions
initCustomErrorConditions(this, settings);
});
})();
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