videojs-errors
Advanced tools
Comparing version 4.1.1 to 4.1.2
@@ -0,1 +1,12 @@ | ||
<a name="4.1.2"></a> | ||
## [4.1.2](https://github.com/brightcove/videojs-errors/compare/v4.1.1...v4.1.2) (2018-08-03) | ||
### Bug Fixes | ||
* babel the es dist, by updating the generator ([#127](https://github.com/brightcove/videojs-errors/issues/127)) ([983b83f](https://github.com/brightcove/videojs-errors/commit/983b83f)) | ||
### Chores | ||
* **package:** update dependencies, enable greenkeeper ([#126](https://github.com/brightcove/videojs-errors/issues/126)) ([7e95841](https://github.com/brightcove/videojs-errors/commit/7e95841)) | ||
<a name="4.1.1"></a> | ||
@@ -2,0 +13,0 @@ ## [4.1.1](https://github.com/brightcove/videojs-errors/compare/v4.1.0...v4.1.1) (2018-07-05) |
@@ -1,2 +0,2 @@ | ||
/*! @name videojs-errors @version 4.1.1 @license Apache-2.0 */ | ||
/*! @name videojs-errors @version 4.1.2 @license Apache-2.0 */ | ||
'use strict'; | ||
@@ -7,33 +7,6 @@ | ||
var videojs = _interopDefault(require('video.js')); | ||
var document = _interopDefault(require('global/document')); | ||
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
var version = "4.1.2"; | ||
var empty = {}; | ||
var empty$1 = /*#__PURE__*/Object.freeze({ | ||
default: empty | ||
}); | ||
var minDoc = ( empty$1 && empty ) || empty$1; | ||
var topLevel = typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : | ||
typeof window !== 'undefined' ? window : {}; | ||
var doccy; | ||
if (typeof document !== 'undefined') { | ||
doccy = document; | ||
} else { | ||
doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4']; | ||
if (!doccy) { | ||
doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc; | ||
} | ||
} | ||
var document_1 = doccy; | ||
var version = "4.1.1"; | ||
var FlashObj = videojs.getComponent('Flash'); | ||
@@ -245,3 +218,3 @@ var defaultDismiss = !videojs.browser.IS_IPHONE; | ||
var error = player.error(); | ||
var content = document_1.createElement('div'); | ||
var content = document.createElement('div'); | ||
var dialogContent = ''; | ||
@@ -248,0 +221,0 @@ |
@@ -1,42 +0,15 @@ | ||
/*! @name videojs-errors @version 4.1.1 @license Apache-2.0 */ | ||
/*! @name videojs-errors @version 4.1.2 @license Apache-2.0 */ | ||
import videojs from 'video.js'; | ||
import document from 'global/document'; | ||
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
var version = "4.1.2"; | ||
var empty = {}; | ||
var FlashObj = videojs.getComponent('Flash'); | ||
var defaultDismiss = !videojs.browser.IS_IPHONE; | ||
var empty$1 = /*#__PURE__*/Object.freeze({ | ||
default: empty | ||
}); | ||
var minDoc = ( empty$1 && empty ) || empty$1; | ||
var topLevel = typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : | ||
typeof window !== 'undefined' ? window : {}; | ||
var doccy; | ||
if (typeof document !== 'undefined') { | ||
doccy = document; | ||
} else { | ||
doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4']; | ||
if (!doccy) { | ||
doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc; | ||
} | ||
} | ||
var document_1 = doccy; | ||
var version = "4.1.1"; | ||
const FlashObj = videojs.getComponent('Flash'); | ||
const defaultDismiss = !videojs.browser.IS_IPHONE; | ||
// Video.js 5/6 cross-compatibility. | ||
const registerPlugin = videojs.registerPlugin || videojs.plugin; | ||
var registerPlugin = videojs.registerPlugin || videojs.plugin; | ||
// Default options for the plugin. | ||
const defaults = { | ||
var defaults = { | ||
header: '', | ||
@@ -55,4 +28,3 @@ code: '', | ||
type: 'MEDIA_ERR_NETWORK', | ||
headline: 'The video connection was lost, please confirm you are ' + | ||
'connected to the internet' | ||
headline: 'The video connection was lost, please confirm you are ' + 'connected to the internet' | ||
}, | ||
@@ -69,4 +41,3 @@ '3': { | ||
type: 'MEDIA_ERR_ENCRYPTED', | ||
headline: 'The video you are trying to watch is encrypted and we do not know how ' + | ||
'to decrypt it' | ||
headline: 'The video you are trying to watch is encrypted and we do not know how ' + 'to decrypt it' | ||
}, | ||
@@ -100,14 +71,14 @@ 'unknown': { | ||
const initPlugin = function(player, options) { | ||
let monitor; | ||
let waiting; | ||
let isStalling; | ||
const listeners = []; | ||
var initPlugin = function initPlugin(player, options) { | ||
var monitor = void 0; | ||
var waiting = void 0; | ||
var isStalling = void 0; | ||
var listeners = []; | ||
const updateErrors = function(updates) { | ||
var updateErrors = function updateErrors(updates) { | ||
options.errors = videojs.mergeOptions(options.errors, updates); | ||
// Create `code`s from errors which don't have them (based on their keys). | ||
Object.keys(options.errors).forEach(k => { | ||
const err = options.errors[k]; | ||
Object.keys(options.errors).forEach(function (k) { | ||
var err = options.errors[k]; | ||
@@ -124,3 +95,3 @@ if (!err.type) { | ||
// clears the previous monitor timeout and sets up a new one | ||
const resetMonitor = function() { | ||
var resetMonitor = function resetMonitor() { | ||
// at this point the player has recovered | ||
@@ -134,3 +105,3 @@ player.clearTimeout(waiting); | ||
// start the loading spinner if player has stalled | ||
waiting = player.setTimeout(function() { | ||
waiting = player.setTimeout(function () { | ||
// player already has an error | ||
@@ -147,3 +118,3 @@ // or is not playing under normal conditions | ||
player.clearTimeout(monitor); | ||
monitor = player.setTimeout(function() { | ||
monitor = player.setTimeout(function () { | ||
// player already has an error | ||
@@ -169,4 +140,4 @@ // or is not playing under normal conditions | ||
// clear any previously registered listeners | ||
const cleanup = function() { | ||
let listener; | ||
var cleanup = function cleanup() { | ||
var listener = void 0; | ||
@@ -182,4 +153,4 @@ while (listeners.length) { | ||
// creates and tracks a player listener if the player looks alive | ||
const healthcheck = function(type, fn) { | ||
const check = function() { | ||
var healthcheck = function healthcheck(type, fn) { | ||
var check = function check() { | ||
// if there's an error do not reset the monitor and | ||
@@ -189,7 +160,5 @@ // clear the error unless time is progressing | ||
// error if using Flash and its API is unavailable | ||
const tech = player.$('.vjs-tech'); | ||
var tech = player.$('.vjs-tech'); | ||
if (tech && | ||
tech.type === 'application/x-shockwave-flash' && | ||
!tech.vjs_getProperty) { | ||
if (tech && tech.type === 'application/x-shockwave-flash' && !tech.vjs_getProperty) { | ||
player.error({ | ||
@@ -219,4 +188,4 @@ code: -2, | ||
const onPlayStartMonitor = function() { | ||
let lastTime = 0; | ||
var onPlayStartMonitor = function onPlayStartMonitor() { | ||
var lastTime = 0; | ||
@@ -227,4 +196,4 @@ cleanup(); | ||
resetMonitor(); | ||
healthcheck(['timeupdate', 'adtimeupdate'], function() { | ||
const currentTime = player.currentTime(); | ||
healthcheck(['timeupdate', 'adtimeupdate'], function () { | ||
var currentTime = player.currentTime(); | ||
@@ -243,3 +212,3 @@ // playback is operating normally or has recovered | ||
const onPlayNoSource = function() { | ||
var onPlayNoSource = function onPlayNoSource() { | ||
if (!player.currentSrc()) { | ||
@@ -253,7 +222,7 @@ player.error({ | ||
const onErrorHandler = function() { | ||
let details = ''; | ||
let error = player.error(); | ||
const content = document_1.createElement('div'); | ||
let dialogContent = ''; | ||
var onErrorHandler = function onErrorHandler() { | ||
var details = ''; | ||
var error = player.error(); | ||
var content = document.createElement('div'); | ||
var dialogContent = ''; | ||
@@ -269,34 +238,22 @@ // In the rare case when `error()` does not return an error object, | ||
if (error.message) { | ||
details = `<div class="vjs-errors-details">${player.localize('Technical details')} | ||
: <div class="vjs-errors-message">${player.localize(error.message)}</div> | ||
</div>`; | ||
details = '<div class="vjs-errors-details">' + player.localize('Technical details') + '\n : <div class="vjs-errors-message">' + player.localize(error.message) + '</div>\n </div>'; | ||
} | ||
if (error.code === 4 && FlashObj && !FlashObj.isSupported()) { | ||
const flashMessage = player.localize( | ||
'If you are using an older browser please try upgrading or installing Flash.' | ||
); | ||
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>'; | ||
} | ||
const display = player.getChild('errorDisplay'); | ||
var display = player.getChild('errorDisplay'); | ||
content.className = 'vjs-errors-dialog'; | ||
content.id = 'vjs-errors-dialog'; | ||
dialogContent = | ||
`<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> | ||
${details} | ||
</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>'; | ||
const closeable = display.closeable(!('dismiss' in error) || error.dismiss); | ||
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"> | ||
<button class="vjs-errors-ok-button">${this.localize('OK')}</button> | ||
</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; | ||
@@ -307,5 +264,5 @@ display.fillWith(content); | ||
const okButton = display.el().querySelector('.vjs-errors-ok-button'); | ||
var okButton = display.el().querySelector('.vjs-errors-ok-button'); | ||
player.on(okButton, 'click', function() { | ||
player.on(okButton, 'click', function () { | ||
display.close(); | ||
@@ -322,6 +279,8 @@ }); | ||
display.one('modalclose', () => player.error(null)); | ||
display.one('modalclose', function () { | ||
return player.error(null); | ||
}); | ||
}; | ||
const onDisposeHandler = function() { | ||
var onDisposeHandler = function onDisposeHandler() { | ||
cleanup(); | ||
@@ -336,3 +295,3 @@ | ||
const reInitPlugin = function(newOptions) { | ||
var reInitPlugin = function reInitPlugin(newOptions) { | ||
onDisposeHandler(); | ||
@@ -342,7 +301,11 @@ initPlugin(player, videojs.mergeOptions(defaults, newOptions)); | ||
reInitPlugin.extend = (errors) => updateErrors(errors); | ||
reInitPlugin.getAll = () => videojs.mergeOptions(options.errors); | ||
reInitPlugin.extend = function (errors) { | ||
return updateErrors(errors); | ||
}; | ||
reInitPlugin.getAll = function () { | ||
return videojs.mergeOptions(options.errors); | ||
}; | ||
// Get / set timeout value. Restart monitor if changed. | ||
reInitPlugin.timeout = function(timeout) { | ||
reInitPlugin.timeout = function (timeout) { | ||
if (typeof timeout === 'undefined') { | ||
@@ -359,3 +322,3 @@ return options.timeout; | ||
reInitPlugin.disableProgress = function(disabled) { | ||
reInitPlugin.disableProgress = function (disabled) { | ||
options.progressDisabled = disabled; | ||
@@ -370,3 +333,3 @@ onPlayStartMonitor(); | ||
player.ready(() => { | ||
player.ready(function () { | ||
player.addClass('vjs-errors'); | ||
@@ -386,11 +349,9 @@ }); | ||
const errors = function(options) { | ||
var errors = function errors(options) { | ||
initPlugin(this, videojs.mergeOptions(defaults, options)); | ||
}; | ||
['extend', 'getAll', 'disableProgress'].forEach(k => { | ||
errors[k] = function() { | ||
videojs.log.warn( | ||
`The errors.${k}() method is not available until the plugin has been initialized!` | ||
); | ||
['extend', 'getAll', 'disableProgress'].forEach(function (k) { | ||
errors[k] = function () { | ||
videojs.log.warn('The errors.' + k + '() method is not available until the plugin has been initialized!'); | ||
}; | ||
@@ -397,0 +358,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
/*! @name videojs-errors @version 4.1.1 @license Apache-2.0 */ | ||
/*! @name videojs-errors @version 4.1.2 @license Apache-2.0 */ | ||
(function (global, factory) { | ||
@@ -11,3 +11,3 @@ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('video.js'), require('global/document')) : | ||
var version = "4.1.1"; | ||
var version = "4.1.2"; | ||
@@ -14,0 +14,0 @@ var FlashObj = videojs.getComponent('Flash'); |
@@ -1,2 +0,2 @@ | ||
/*! @name videojs-errors @version 4.1.1 @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.1",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.1",n("errors",s),s}); | ||
/*! @name videojs-errors @version 4.1.2 @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.2",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.2",n("errors",s),s}); |
{ | ||
"name": "videojs-errors", | ||
"version": "4.1.1", | ||
"version": "4.1.2", | ||
"author": "Brightcove, Inc.", | ||
@@ -18,3 +18,3 @@ "description": "A Video.js plugin for custom error reporting", | ||
"generator-videojs-plugin": { | ||
"version": "6.1.1" | ||
"version": "6.1.4" | ||
}, | ||
@@ -68,3 +68,3 @@ "scripts": { | ||
"devDependencies": { | ||
"autoprefixer": "^8.6.0", | ||
"autoprefixer": "^9.0.0", | ||
"babel-core": "^6.26.3", | ||
@@ -76,3 +76,3 @@ "babel-plugin-external-helpers": "^6.22.0", | ||
"conventional-changelog-videojs": "^3.0.0", | ||
"cssnano": "^3.10.0", | ||
"cssnano": "^4.0.3", | ||
"doctoc": "^1.3.1", | ||
@@ -96,3 +96,3 @@ "husky": "^0.14.3", | ||
"postcss-banner": "^3.0.0", | ||
"postcss-cli": "^5.0.0", | ||
"postcss-cli": "^6.0.0", | ||
"postcss-import": "^11.1.0", | ||
@@ -102,3 +102,3 @@ "postcss-preset-env": "^5.1.0", | ||
"rimraf": "^2.6.1", | ||
"rollup": "^0.60.1", | ||
"rollup": "^0.63.2", | ||
"rollup-plugin-babel": "^3.0.4", | ||
@@ -109,3 +109,2 @@ "rollup-plugin-commonjs": "^9.1.3", | ||
"rollup-plugin-node-resolve": "^3.0.0", | ||
"rollup-plugin-replace": "^1.1.1", | ||
"rollup-plugin-uglify": "^4.0.0", | ||
@@ -117,3 +116,3 @@ "semver": "^5.1.0", | ||
"videojs-languages": "^1.0.0", | ||
"videojs-standard": "^6.0.0" | ||
"videojs-standard": "^6.0.3" | ||
}, | ||
@@ -120,0 +119,0 @@ "browserslist": [ |
@@ -13,8 +13,13 @@ /** | ||
/* General Globals */ | ||
const moduleName = 'videojsErrors'; | ||
const pluginName = 'videojs-errors'; | ||
const mainFile = 'src/plugin.js'; | ||
const banner = `/*! @name ${pkg.name} @version ${pkg.version} @license ${pkg.license} */`; | ||
/* to prevent going into a screen during rollup */ | ||
process.stderr.isTTY = false; | ||
let isWatch = false; | ||
process.argv.forEach((a) => { | ||
if ((/-w|--watch/).test(a)) { | ||
isWatch = true; | ||
} | ||
}); | ||
/* configuration for plugins */ | ||
@@ -40,15 +45,7 @@ const primedPlugins = { | ||
// to prevent a screen during rollup watch/build | ||
process.stderr.isTTY = false; | ||
/* General Globals */ | ||
const moduleName = 'videojsErrors'; | ||
const pluginName = 'videojs-errors'; | ||
let isWatch = false; | ||
process.argv.forEach((a) => { | ||
if ((/-w|--watch/).test(a)) { | ||
isWatch = true; | ||
} | ||
}); | ||
// globals, aka replace require calls | ||
// with this | ||
// globals, aka replace require calls with this | ||
const globals = { | ||
@@ -72,5 +69,4 @@ umd: { | ||
// externals, aka don't bundle there | ||
// and if not listed as a global don't require | ||
// them either | ||
// externals, aka don't bundle these and if not | ||
// listed as a global don't require them either | ||
const externals = { | ||
@@ -81,3 +77,5 @@ umd: Object.keys(globals.umd).concat([ | ||
module: Object.keys(globals.module).concat([ | ||
'global', | ||
'global/document', | ||
'global/window' | ||
]), | ||
@@ -92,3 +90,2 @@ test: Object.keys(globals.test).concat([ | ||
// note uglify will be added before babel for minified bundle | ||
// see minPlugins below | ||
umd: [ | ||
@@ -101,4 +98,2 @@ primedPlugins.resolve, | ||
// note babel will be removed for es module bundle | ||
// see esPlugins below | ||
module: [ | ||
@@ -120,77 +115,76 @@ primedPlugins.resolve, | ||
// clone module plugins, remove babel | ||
const esPlugins = plugins.module.slice(); | ||
/* make a build with the specifed settings */ | ||
const makeBuild = (name, settings) => { | ||
const b = Object.assign({}, { | ||
plugins: plugins[name], | ||
external: externals[name], | ||
input: 'src/plugin.js' | ||
}, settings); | ||
esPlugins.splice(plugins.module.indexOf(primedPlugins.babel), 1); | ||
const fixOutput = (o) => { | ||
if (!o.banner) { | ||
o.banner = `/*! @name ${pkg.name} @version ${pkg.version} @license ${pkg.license} */`; | ||
} | ||
if (!o.globals) { | ||
o.globals = globals[name]; | ||
} | ||
// clone umd plugins, remove babel, add uglify then babel | ||
const minPlugins = plugins.umd.slice(); | ||
return o; | ||
}; | ||
minPlugins.splice(plugins.umd.indexOf(primedPlugins.babel), 1); | ||
minPlugins.push(primedPlugins.uglify); | ||
minPlugins.push(primedPlugins.babel); | ||
if (!Array.isArray(b.output)) { | ||
b.output = fixOutput(b.output); | ||
} else { | ||
b.output = b.output.map(fixOutput); | ||
} | ||
const builds = [{ | ||
// umd | ||
input: mainFile, | ||
output: { | ||
name: moduleName, | ||
file: `dist/${pluginName}.js`, | ||
format: 'umd', | ||
globals: globals.umd, | ||
banner | ||
}, | ||
external: externals.umd, | ||
plugins: plugins.umd | ||
}, { | ||
// cjs | ||
input: mainFile, | ||
output: [{ | ||
file: `dist/${pluginName}.cjs.js`, | ||
format: 'cjs', | ||
globals: globals.module, | ||
banner | ||
}], | ||
external: externals.module, | ||
plugins: plugins.module | ||
}, { | ||
// es | ||
input: mainFile, | ||
output: [{ | ||
file: `dist/${pluginName}.es.js`, | ||
format: 'es', | ||
globals: globals.module, | ||
banner | ||
}], | ||
external: externals.module, | ||
plugins: esPlugins | ||
}, { | ||
// test bundle | ||
input: 'test/**/*.test.js', | ||
output: { | ||
name: `${moduleName}Tests`, | ||
file: 'test/dist/bundle.js', | ||
format: 'iife', | ||
globals: globals.test | ||
}, | ||
external: externals.test, | ||
plugins: plugins.test | ||
}]; | ||
return b; | ||
}; | ||
/* all rollup builds by name. note only object values will be used */ | ||
const builds = { | ||
umd: makeBuild('umd', { | ||
output: [{ | ||
name: moduleName, | ||
file: `dist/${pluginName}.js`, | ||
format: 'umd' | ||
}] | ||
}), | ||
cjs: makeBuild('module', { | ||
output: [{ | ||
file: `dist/${pluginName}.cjs.js`, | ||
format: 'cjs' | ||
}] | ||
}), | ||
es: makeBuild('module', { | ||
output: [{ | ||
file: `dist/${pluginName}.es.js`, | ||
format: 'es' | ||
}] | ||
}), | ||
test: makeBuild('test', { | ||
input: 'test/**/*.test.js', | ||
output: [{ | ||
name: `${moduleName}Tests`, | ||
file: 'test/dist/bundle.js', | ||
format: 'iife' | ||
}] | ||
}) | ||
}; | ||
if (!isWatch) { | ||
builds.push({ | ||
// minified umd | ||
input: mainFile, | ||
output: { | ||
builds.minUmd = makeBuild('umd', { | ||
output: [{ | ||
name: moduleName, | ||
file: `dist/${pluginName}.min.js`, | ||
format: 'umd', | ||
globals: globals.umd, | ||
banner | ||
}, | ||
external: externals.umd, | ||
plugins: minPlugins | ||
format: 'umd' | ||
}], | ||
// we need to minify before babel | ||
plugins: plugins.umd | ||
.filter((p) => p !== primedPlugins.babel) | ||
.concat([primedPlugins.uglify, primedPlugins.babel]) | ||
}); | ||
} | ||
export default builds; | ||
export default Object.values(builds); |
@@ -0,1 +1,2 @@ | ||
/*! @name videojs-errors @version 4.1.2 @license Apache-2.0 */ | ||
(function (videojs,QUnit,sinon) { | ||
@@ -36,3 +37,3 @@ 'use strict'; | ||
var version = "4.1.1"; | ||
var version = "4.1.2"; | ||
@@ -39,0 +40,0 @@ var FlashObj = videojs.getComponent('Flash'); |
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
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
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
44
1172085
60
3684
2