videojs-errors
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -5,8 +5,18 @@ CHANGELOG | ||
## HEAD (Unreleased) | ||
-------------------- | ||
## 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) | ||
* @vdeshpande Close-button errors message accessible fix (#40) | ||
-------------------- | ||
## v1.0.4 (2016-04-13) | ||
@@ -13,0 +23,0 @@ * Added listening for `'adtimeupdate'` ([#36](https://github.com/brightcove/videojs-errors/pull/36)) |
@@ -114,5 +114,5 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
monitor = _globalWindow2['default'].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; | ||
@@ -128,2 +128,3 @@ } | ||
// clear out any existing player timeout | ||
// playback has recovered | ||
if (player.error() && player.error().code === -2) { | ||
@@ -148,11 +149,26 @@ player.error(null); | ||
var check = function check() { | ||
// playback isn't expected if the player is paused, shut | ||
// down monitoring | ||
if (player.paused()) { | ||
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 | ||
var 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(); | ||
} | ||
} | ||
// playback isn't expected once the video has ended | ||
if (player.ended()) { | ||
return resetMonitor(); | ||
} | ||
fn.call(this); | ||
@@ -175,2 +191,3 @@ }; | ||
// playback is operating normally or has recovered | ||
if (currentTime !== lastTime) { | ||
@@ -398,2 +415,26 @@ lastTime = currentTime; | ||
_qunit2['default'].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; | ||
}; | ||
var 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'); | ||
}); | ||
_qunit2['default'].test('the plugin cleans up after its previous incarnation when called again', function (assert) { | ||
@@ -400,0 +441,0 @@ var errors = 0; |
/** | ||
* videojs-errors | ||
* @version 1.1.1 | ||
* @version 1.1.2 | ||
* @copyright 2016 Brightcove | ||
@@ -120,5 +120,5 @@ * @license Apache-2.0 | ||
monitor = _globalWindow2['default'].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; | ||
@@ -134,2 +134,3 @@ } | ||
// clear out any existing player timeout | ||
// playback has recovered | ||
if (player.error() && player.error().code === -2) { | ||
@@ -154,11 +155,26 @@ player.error(null); | ||
var check = function check() { | ||
// playback isn't expected if the player is paused, shut | ||
// down monitoring | ||
if (player.paused()) { | ||
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 | ||
var 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(); | ||
} | ||
} | ||
// playback isn't expected once the video has ended | ||
if (player.ended()) { | ||
return resetMonitor(); | ||
} | ||
fn.call(this); | ||
@@ -181,2 +197,3 @@ }; | ||
// playback is operating normally or has recovered | ||
if (currentTime !== lastTime) { | ||
@@ -183,0 +200,0 @@ lastTime = currentTime; |
/** | ||
* videojs-errors | ||
* @version 1.1.1 | ||
* @version 1.1.2 | ||
* @copyright 2016 Brightcove | ||
* @license Apache-2.0 | ||
*/ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o;o="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,o.videojsErrors=e()}}(function(){return function e(o,n,t){function i(d,l){if(!n[d]){if(!o[d]){var s="function"==typeof require&&require;if(!l&&s)return s(d,!0);if(r)return r(d,!0);var a=new Error("Cannot find module '"+d+"'");throw a.code="MODULE_NOT_FOUND",a}var f=n[d]={exports:{}};o[d][0].call(f.exports,function(e){var n=o[d][1][e];return i(n?n:e)},f,f.exports,e,o,n,t)}return n[d].exports}for(var r="function"==typeof require&&require,d=0;d<t.length;d++)i(t[d]);return i}({1:[function(e,o,n){},{}],2:[function(e,o,n){(function(n){var t="undefined"!=typeof n?n:"undefined"!=typeof window?window:{},i=e("min-document");if("undefined"!=typeof document)o.exports=document;else{var r=t["__GLOBAL_DOCUMENT_CACHE@4"];r||(r=t["__GLOBAL_DOCUMENT_CACHE@4"]=i),o.exports=r}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"min-document":1}],3:[function(e,o,n){(function(e){"undefined"!=typeof window?o.exports=window:"undefined"!=typeof e?o.exports=e:"undefined"!=typeof self?o.exports=self:o.exports={}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],4:[function(e,o,n){(function(t){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0});var r="undefined"!=typeof window?window.videojs:"undefined"!=typeof t?t.videojs:null,d=i(r),l=e("global/window"),s=i(l),a=e("global/document"),f=i(a),u=d.default.getComponent("Flash"),c={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"}}},p=function e(o,n){var t=void 0,i=[],r=function(){s.default.clearTimeout(t),t=s.default.setTimeout(function(){o.error()||o.paused()||o.ended()||o.error({code:-2,type:"PLAYER_ERR_TIMEOUT"})},n.timeout),o.error()&&o.error().code===-2&&o.error(null)},l=function(){for(var e=void 0;i.length;)e=i.shift(),o.off(e[0],e[1]);s.default.clearTimeout(t)},a=function(e,n){var t=function(){return o.paused()?r():o.ended()?r():void n.call(this)};o.on(e,t),i.push([e,t])},p=function(){var e=0;l(),r(),a(["timeupdate","adtimeupdate"],function(){var n=o.currentTime();n!==e&&(e=n,r())}),a("progress",r)},v=function(){o.currentSrc()||o.error({code:-1,type:"PLAYER_ERR_NO_SRC"})},h=function(){var e=void 0,t="",i=o.error(),r=f.default.createElement("div");if(i){if(i=d.default.mergeOptions(i,n.errors[i.code||0]),i.message&&(t='<div class="vjs-errors-details">'+o.localize("Technical details")+'\n : <div class="vjs-errors-message">'+o.localize(i.message)+"</div>\n </div>"),4===i.code&&!u.isSupported()){var l=o.localize(" * If you are using an older browser please try upgrading or installing Flash.");t+='<span class="vjs-errors-flashmessage">'+l+"</span>"}e=o.getChild("errorDisplay"),e.getChild("closeButton")&&e.removeChild("closeButton"),e.closeable(!0),r.className="vjs-errors-dialog",r.id="vjs-errors-dialog",r.innerHTML='<div class="vjs-errors-content-container">\n <h2 class="vjs-errors-headline">'+this.localize(i.headline)+"</h2>\n <div><b>"+this.localize("Error Code")+"</b>: "+(i.type||i.code)+"</div>\n "+t+'\n </div>\n <div class="vjs-errors-ok-button-container">\n <button class="vjs-errors-ok-button">'+this.localize("OK")+"</button>\n </div>",e.fillWith(r),e.contentEl().firstChild.appendChild(e.getChild("closeButton").el()),(o.width()<=600||o.height()<=250)&&e.addClass("vjs-xs");var s=e.el().querySelector(".vjs-errors-ok-button");d.default.on(s,"click",function(){e.close()})}},y=function e(){l(),o.removeClass("vjs-errors"),o.off("play",p),o.off("play",v),o.off("dispose",e),o.off("error",h)},w=function(n){y(),e(o,d.default.mergeOptions(c,n))};o.on("play",p),o.on("play",v),o.on("dispose",y),o.on("error",h),o.ready(function(){o.addClass("vjs-errors")}),o.errors=w},v=function(e){p(this,d.default.mergeOptions(c,e))};d.default.plugin("errors",v),n.default=v,o.exports=n.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"global/document":2,"global/window":3}]},{},[4])(4)}); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o;o="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,o.videojsErrors=e()}}(function(){return function e(o,n,t){function r(d,l){if(!n[d]){if(!o[d]){var s="function"==typeof require&&require;if(!l&&s)return s(d,!0);if(i)return i(d,!0);var a=new Error("Cannot find module '"+d+"'");throw a.code="MODULE_NOT_FOUND",a}var f=n[d]={exports:{}};o[d][0].call(f.exports,function(e){var n=o[d][1][e];return r(n?n:e)},f,f.exports,e,o,n,t)}return n[d].exports}for(var i="function"==typeof require&&require,d=0;d<t.length;d++)r(t[d]);return r}({1:[function(e,o,n){},{}],2:[function(e,o,n){(function(n){var t="undefined"!=typeof n?n:"undefined"!=typeof window?window:{},r=e("min-document");if("undefined"!=typeof document)o.exports=document;else{var i=t["__GLOBAL_DOCUMENT_CACHE@4"];i||(i=t["__GLOBAL_DOCUMENT_CACHE@4"]=r),o.exports=i}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"min-document":1}],3:[function(e,o,n){(function(e){"undefined"!=typeof window?o.exports=window:"undefined"!=typeof e?o.exports=e:"undefined"!=typeof self?o.exports=self:o.exports={}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],4:[function(e,o,n){(function(t){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0});var i="undefined"!=typeof window?window.videojs:"undefined"!=typeof t?t.videojs:null,d=r(i),l=e("global/window"),s=r(l),a=e("global/document"),f=r(a),u=d.default.getComponent("Flash"),c={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"}}},p=function e(o,n){var t=void 0,r=[],i=function(){s.default.clearTimeout(t),t=s.default.setTimeout(function(){o.error()||o.paused()||o.ended()||o.error({code:-2,type:"PLAYER_ERR_TIMEOUT"})},n.timeout),o.error()&&o.error().code===-2&&o.error(null)},l=function(){for(var e=void 0;r.length;)e=r.shift(),o.off(e[0],e[1]);s.default.clearTimeout(t)},a=function(e,n){var t=function(){if(!o.error()){var e=o.$(".vjs-tech");if(e&&"application/x-shockwave-flash"===e.type&&!e.vjs_getProperty)return void o.error({code:-2,type:"PLAYER_ERR_TIMEOUT"});if(o.paused())return i();if(o.ended())return i()}n.call(this)};o.on(e,t),r.push([e,t])},p=function(){var e=0;l(),i(),a(["timeupdate","adtimeupdate"],function(){var n=o.currentTime();n!==e&&(e=n,i())}),a("progress",i)},v=function(){o.currentSrc()||o.error({code:-1,type:"PLAYER_ERR_NO_SRC"})},h=function(){var e=void 0,t="",r=o.error(),i=f.default.createElement("div");if(r){if(r=d.default.mergeOptions(r,n.errors[r.code||0]),r.message&&(t='<div class="vjs-errors-details">'+o.localize("Technical details")+'\n : <div class="vjs-errors-message">'+o.localize(r.message)+"</div>\n </div>"),4===r.code&&!u.isSupported()){var l=o.localize(" * If you are using an older browser please try upgrading or installing Flash.");t+='<span class="vjs-errors-flashmessage">'+l+"</span>"}e=o.getChild("errorDisplay"),e.getChild("closeButton")&&e.removeChild("closeButton"),e.closeable(!0),i.className="vjs-errors-dialog",i.id="vjs-errors-dialog",i.innerHTML='<div class="vjs-errors-content-container">\n <h2 class="vjs-errors-headline">'+this.localize(r.headline)+"</h2>\n <div><b>"+this.localize("Error Code")+"</b>: "+(r.type||r.code)+"</div>\n "+t+'\n </div>\n <div class="vjs-errors-ok-button-container">\n <button class="vjs-errors-ok-button">'+this.localize("OK")+"</button>\n </div>",e.fillWith(i),e.contentEl().firstChild.appendChild(e.getChild("closeButton").el()),(o.width()<=600||o.height()<=250)&&e.addClass("vjs-xs");var s=e.el().querySelector(".vjs-errors-ok-button");d.default.on(s,"click",function(){e.close()})}},y=function e(){l(),o.removeClass("vjs-errors"),o.off("play",p),o.off("play",v),o.off("dispose",e),o.off("error",h)},w=function(n){y(),e(o,d.default.mergeOptions(c,n))};o.on("play",p),o.on("play",v),o.on("dispose",y),o.on("error",h),o.ready(function(){o.addClass("vjs-errors")}),o.errors=w},v=function(e){p(this,d.default.mergeOptions(c,e))};d.default.plugin("errors",v),n.default=v,o.exports=n.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"global/document":2,"global/window":3}]},{},[4])(4)}); |
@@ -78,5 +78,5 @@ 'use strict'; | ||
monitor = _globalWindow2['default'].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; | ||
@@ -92,2 +92,3 @@ } | ||
// clear out any existing player timeout | ||
// playback has recovered | ||
if (player.error() && player.error().code === -2) { | ||
@@ -112,11 +113,26 @@ player.error(null); | ||
var check = function check() { | ||
// playback isn't expected if the player is paused, shut | ||
// down monitoring | ||
if (player.paused()) { | ||
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 | ||
var 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(); | ||
} | ||
} | ||
// playback isn't expected once the video has ended | ||
if (player.ended()) { | ||
return resetMonitor(); | ||
} | ||
fn.call(this); | ||
@@ -139,2 +155,3 @@ }; | ||
// playback is operating normally or has recovered | ||
if (currentTime !== lastTime) { | ||
@@ -141,0 +158,0 @@ lastTime = currentTime; |
{ | ||
"name": "videojs-errors", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"author": "Brightcove", | ||
@@ -5,0 +5,0 @@ "description": "A VideoJS plugin for custom error reporting", |
@@ -64,5 +64,5 @@ import videojs from 'video.js'; | ||
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; | ||
@@ -78,2 +78,3 @@ } | ||
// clear out any existing player timeout | ||
// playback has recovered | ||
if (player.error() && player.error().code === -2) { | ||
@@ -98,11 +99,28 @@ player.error(null); | ||
let check = function() { | ||
// playback isn't expected if the player is paused, shut | ||
// down monitoring | ||
if (player.paused()) { | ||
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(); | ||
} | ||
} | ||
// playback isn't expected once the video has ended | ||
if (player.ended()) { | ||
return resetMonitor(); | ||
} | ||
fn.call(this); | ||
@@ -125,2 +143,3 @@ }; | ||
// playback is operating normally or has recovered | ||
if (currentTime !== lastTime) { | ||
@@ -127,0 +146,0 @@ lastTime = currentTime; |
@@ -111,2 +111,26 @@ import document from 'global/document'; | ||
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', | ||
@@ -113,0 +137,0 @@ function(assert) { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
99643
1883
0