videojs-errors
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -221,3 +221,3 @@ (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){ | ||
} | ||
if (error.code === 4 && !FlashObj.isSupported()) { | ||
if (error.code === 4 && FlashObj && !FlashObj.isSupported()) { | ||
var flashMessage = player.localize(' * If you are using an older browser' + ' please try upgrading or installing Flash.'); | ||
@@ -374,3 +374,3 @@ | ||
assert.strictEqual(Player.prototype.errors, _srcPlugin2['default'], 'videojs-errors plugin was registered'); | ||
assert.strictEqual(typeof Player.prototype.errors, 'function', 'videojs-errors plugin was registered'); | ||
@@ -684,2 +684,10 @@ this.player.errors(); | ||
_qunit2['default'].test('Append Flash error details when flash is not supported', function (assert) { | ||
var Flash = _videoJs2['default'].getTech('Flash'); | ||
// vjs6 won't have flash by default | ||
if (!Flash) { | ||
assert.notOk(Flash, 'flash tech not available, skipping unit test'); | ||
return; | ||
} | ||
var oldIsSupported = _videoJs2['default'].getComponent('Flash').isSupported; | ||
@@ -686,0 +694,0 @@ |
/** | ||
* videojs-errors | ||
* @version 1.1.2 | ||
* @copyright 2016 Brightcove | ||
* @version 1.1.3 | ||
* @copyright 2017 Brightcove | ||
* @license Apache-2.0 | ||
@@ -227,3 +227,3 @@ */ | ||
} | ||
if (error.code === 4 && !FlashObj.isSupported()) { | ||
if (error.code === 4 && FlashObj && !FlashObj.isSupported()) { | ||
var flashMessage = player.localize(' * If you are using an older browser' + ' please try upgrading or installing Flash.'); | ||
@@ -230,0 +230,0 @@ |
/** | ||
* videojs-errors | ||
* @version 1.1.2 | ||
* @copyright 2016 Brightcove | ||
* @version 1.1.3 | ||
* @copyright 2017 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 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)}); | ||
!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 h(e,o){var n=void 0,t=[],r=function(){s["default"].clearTimeout(n),n=s["default"].setTimeout(function(){e.error()||e.paused()||e.ended()||e.error({code:-2,type:"PLAYER_ERR_TIMEOUT"})},o.timeout),e.error()&&-2===e.error().code&&e.error(null)},i=function(){for(var o=void 0;t.length;)o=t.shift(),e.off(o[0],o[1]);s["default"].clearTimeout(n)},l=function(o,n){var i=function(){if(!e.error()){var o=e.$(".vjs-tech");if(o&&"application/x-shockwave-flash"===o.type&&!o.vjs_getProperty)return void e.error({code:-2,type:"PLAYER_ERR_TIMEOUT"});if(e.paused())return r();if(e.ended())return r()}n.call(this)};e.on(o,i),t.push([o,i])},a=function(){var o=0;i(),r(),l(["timeupdate","adtimeupdate"],function(){var n=e.currentTime();n!==o&&(o=n,r())}),l("progress",r)},p=function(){e.currentSrc()||e.error({code:-1,type:"PLAYER_ERR_NO_SRC"})},v=function(){var n=void 0,t="",r=e.error(),i=f["default"].createElement("div");if(r){if(r=d["default"].mergeOptions(r,o.errors[r.code||0]),r.message&&(t='<div class="vjs-errors-details">'+e.localize("Technical details")+'\n : <div class="vjs-errors-message">'+e.localize(r.message)+"</div>\n </div>"),4===r.code&&u&&!u.isSupported()){var l=e.localize(" * If you are using an older browser please try upgrading or installing Flash.");t+='<span class="vjs-errors-flashmessage">'+l+"</span>"}n=e.getChild("errorDisplay"),n.getChild("closeButton")&&n.removeChild("closeButton"),n.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>",n.fillWith(i),n.contentEl().firstChild.appendChild(n.getChild("closeButton").el()),(e.width()<=600||e.height()<=250)&&n.addClass("vjs-xs");var s=n.el().querySelector(".vjs-errors-ok-button");d["default"].on(s,"click",function(){n.close()})}},y=function E(){i(),e.removeClass("vjs-errors"),e.off("play",a),e.off("play",p),e.off("dispose",E),e.off("error",v)},w=function(o){y(),h(e,d["default"].mergeOptions(c,o))};e.on("play",a),e.on("play",p),e.on("dispose",y),e.on("error",v),e.ready(function(){e.addClass("vjs-errors")}),e.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)}); |
@@ -185,3 +185,3 @@ 'use strict'; | ||
} | ||
if (error.code === 4 && !FlashObj.isSupported()) { | ||
if (error.code === 4 && FlashObj && !FlashObj.isSupported()) { | ||
var flashMessage = player.localize(' * If you are using an older browser' + ' please try upgrading or installing Flash.'); | ||
@@ -188,0 +188,0 @@ |
{ | ||
"name": "videojs-errors", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"author": "Brightcove", | ||
@@ -5,0 +5,0 @@ "description": "A VideoJS plugin for custom error reporting", |
@@ -175,3 +175,3 @@ import videojs from 'video.js'; | ||
} | ||
if (error.code === 4 && !FlashObj.isSupported()) { | ||
if (error.code === 4 && FlashObj && !FlashObj.isSupported()) { | ||
const flashMessage = player.localize(' * If you are using an older browser' + | ||
@@ -178,0 +178,0 @@ ' please try upgrading or installing Flash.'); |
@@ -65,4 +65,4 @@ import document from 'global/document'; | ||
assert.strictEqual( | ||
Player.prototype.errors, | ||
plugin, | ||
typeof Player.prototype.errors, | ||
'function', | ||
'videojs-errors plugin was registered' | ||
@@ -387,2 +387,10 @@ ); | ||
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; | ||
@@ -389,0 +397,0 @@ |
Sorry, the diff of this file is not supported yet
100123
1895