videojs-errors
Advanced tools
Comparing version 1.0.0 to 1.0.2
@@ -1,9 +0,9 @@ | ||
videojs.addLanguage("de",{ | ||
"No video has been loaded": "Es wurde kein Video geladen.", | ||
"Could not download the video": "Das Video konnte nicht heruntergeladen werden.", | ||
"The video connection was lost, please confirm you are connected to the internet": "Die Videoverbindung wurde abgebrochen, überprüfen Sie, ob eine Internetverbindung besteht.", | ||
"The video is bad or in a format that cannot be played on your browser": "Dieses Video ist beschädigt, oder das Format ist mit Ihrem Browser nicht abspielbar.", | ||
"This video is either unavailable or not supported in this browser": "Dieses Video ist entweder nicht verfügbar, oder es wird in diesem Browser nicht unterstützt.", | ||
"Error Code": "Fehlercode", | ||
"Technical details": "Technische Details" | ||
videojs.addLanguage('de', { | ||
"No video has been loaded": "Es wurde kein Video geladen.", | ||
"Could not download the video": "Das Video konnte nicht heruntergeladen werden.", | ||
"The video connection was lost, please confirm you are connected to the internet": "Die Videoverbindung wurde abgebrochen, überprüfen Sie, ob eine Internetverbindung besteht.", | ||
"The video is bad or in a format that cannot be played on your browser": "Dieses Video ist beschädigt, oder das Format ist mit Ihrem Browser nicht abspielbar.", | ||
"This video is either unavailable or not supported in this browser": "Dieses Video ist entweder nicht verfügbar, oder es wird in diesem Browser nicht unterstützt.", | ||
"Error Code": "Fehlercode", | ||
"Technical details": "Technische Details" | ||
}); |
@@ -1,9 +0,9 @@ | ||
videojs.addLanguage("es",{ | ||
"No video has been loaded": "No hay ningún vídeo cargado.", | ||
"Could not download the video": "No se ha podido descargar el vídeo.", | ||
"The video connection was lost, please confirm you are connected to the internet": "Se ha perdido la conexión al vídeo. Compruebe si su equipo está conectado a internet.", | ||
"The video is bad or in a format that cannot be played on your browser": "El vídeo está dañado o tiene un formato no reproducible en su navegador.", | ||
"This video is either unavailable or not supported in this browser": "Este vídeo no está disponible o es incompatible con este navegador.", | ||
"Error Code": "Código de error", | ||
"Technical details": "Detalles técnicos" | ||
videojs.addLanguage('es', { | ||
"No video has been loaded": "No hay ningún vídeo cargado.", | ||
"Could not download the video": "No se ha podido descargar el vídeo.", | ||
"The video connection was lost, please confirm you are connected to the internet": "Se ha perdido la conexión al vídeo. Compruebe si su equipo está conectado a internet.", | ||
"The video is bad or in a format that cannot be played on your browser": "El vídeo está dañado o tiene un formato no reproducible en su navegador.", | ||
"This video is either unavailable or not supported in this browser": "Este vídeo no está disponible o es incompatible con este navegador.", | ||
"Error Code": "Código de error", | ||
"Technical details": "Detalles técnicos" | ||
}); |
@@ -1,9 +0,9 @@ | ||
videojs.addLanguage("fr",{ | ||
"No video has been loaded": "Aucune vidéo n'a été chargée.", | ||
"Could not download the video": "Impossible de télécharger la vidéo.", | ||
"The video connection was lost, please confirm you are connected to the internet": "La connexion à la vidéo a été perdue, vérifiez que vous êtes bien connecté à Internet.", | ||
"The video is bad or in a format that cannot be played on your browser": "La vidéo est de mauvaise qualité ou dans un format incompatible avec votre navigateur.", | ||
"This video is either unavailable or not supported in this browser": "ette vidéo est indisponible ou non prise en charge par ce navigateur.", | ||
"Error Code": "Code d'erreur", | ||
"Technical details": "Détails techniques" | ||
videojs.addLanguage('fr', { | ||
"No video has been loaded": "Aucune vidéo n'a été chargée.", | ||
"Could not download the video": "Impossible de télécharger la vidéo.", | ||
"The video connection was lost, please confirm you are connected to the internet": "La connexion à la vidéo a été perdue, vérifiez que vous êtes bien connecté à Internet.", | ||
"The video is bad or in a format that cannot be played on your browser": "La vidéo est de mauvaise qualité ou dans un format incompatible avec votre navigateur.", | ||
"This video is either unavailable or not supported in this browser": "ette vidéo est indisponible ou non prise en charge par ce navigateur.", | ||
"Error Code": "Code d'erreur", | ||
"Technical details": "Détails techniques" | ||
}); |
@@ -1,9 +0,9 @@ | ||
videojs.addLanguage("ja",{ | ||
"No video has been loaded": "動画がロードされませんでした", | ||
"Could not download the video": "動画をダウンロードできませんでした", | ||
"The video connection was lost, please confirm you are connected to the internet": "動画の接続が失われました。インターネットに接続していることを確認してください", | ||
"The video is bad or in a format that cannot be played on your browser": "動画が悪いか、お役様のブラウザで再生できない動画フォーマットです。", | ||
"This video is either unavailable or not supported in this browser": "この動画は利用できないか、このブラウザによってサポートされていません", | ||
"Error Code": "エラー コード", | ||
"Technical details": "技術面の詳細" | ||
videojs.addLanguage('ja', { | ||
"No video has been loaded": "動画がロードされませんでした", | ||
"Could not download the video": "動画をダウンロードできませんでした", | ||
"The video connection was lost, please confirm you are connected to the internet": "動画の接続が失われました。インターネットに接続していることを確認してください", | ||
"The video is bad or in a format that cannot be played on your browser": "動画が悪いか、お役様のブラウザで再生できない動画フォーマットです。", | ||
"This video is either unavailable or not supported in this browser": "この動画は利用できないか、このブラウザによってサポートされていません", | ||
"Error Code": "エラー コード", | ||
"Technical details": "技術面の詳細" | ||
}); |
@@ -1,9 +0,9 @@ | ||
videojs.addLanguage("ko",{ | ||
"No video has been loaded": "비디오가 로드되지 않았습니다.", | ||
"Could not download the video": "비디오를 다운로드하지 못 했습니다.", | ||
"The video connection was lost, please confirm you are connected to the internet": "비디오 연결이 끊겼습니다. 인터넷 연결 상태를 확인하십시오.", | ||
"The video is bad or in a format that cannot be played on your browser": "비디오 상태가 불량이거나 브라우저에서 재생할 수 없는 형식입니다.", | ||
"This video is either unavailable or not supported in this browser": "브라우저에서 이 비디오를 사용할 수 없거나 지원하지 않습니다.", | ||
"Error Code": "오류 코드", | ||
"Technical details": "기술 세부사항" | ||
videojs.addLanguage('ko', { | ||
"No video has been loaded": "비디오가 로드되지 않았습니다.", | ||
"Could not download the video": "비디오를 다운로드하지 못 했습니다.", | ||
"The video connection was lost, please confirm you are connected to the internet": "비디오 연결이 끊겼습니다. 인터넷 연결 상태를 확인하십시오.", | ||
"The video is bad or in a format that cannot be played on your browser": "비디오 상태가 불량이거나 브라우저에서 재생할 수 없는 형식입니다.", | ||
"This video is either unavailable or not supported in this browser": "브라우저에서 이 비디오를 사용할 수 없거나 지원하지 않습니다.", | ||
"Error Code": "오류 코드", | ||
"Technical details": "기술 세부사항" | ||
}); |
@@ -1,213 +0,235 @@ | ||
/*! videojs-errors - v1.0.0 - 2015-11-23 | ||
* Copyright (c) 2015 Brightcove; Licensed Apache-2.0 */ | ||
(function(){ | ||
var | ||
defaults = { | ||
header: '', | ||
code: '', | ||
message: '', | ||
timeout: 45 * 1000, | ||
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' | ||
} | ||
} | ||
}, | ||
/** | ||
* Monitors a player for signs of life during playback and | ||
* triggers PLAYER_ERR_TIMEOUT if none occur within a reasonable | ||
* timeframe. | ||
*/ | ||
monitorPlayback = function(player, options) { | ||
var | ||
settings = videojs.mergeOptions(defaults, options), | ||
/** | ||
* videojs-errors | ||
* @version 1.0.2 | ||
* @copyright 2016 Brightcove | ||
* @license Apache-2.0 | ||
*/ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.videojsErrors = f()}})(function(){var define,module,exports;return (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){ | ||
(function (global){ | ||
'use strict'; | ||
monitor, | ||
// clears the previous monitor timeout and sets up a new one | ||
resetMonitor = function() { | ||
window.clearTimeout(monitor); | ||
monitor = window.setTimeout(function() { | ||
if (player.error() || player.paused() || player.ended()) { | ||
// never overwrite existing errors or display a new one | ||
// if the player is paused or ended. | ||
return; | ||
} | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
player.error({ | ||
code: -2, | ||
type: 'PLAYER_ERR_TIMEOUT' | ||
}); | ||
}, settings.timeout); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
// clear out any existing player timeout | ||
if (player.error() && player.error().code === -2) { | ||
player.error(null); | ||
} | ||
}, | ||
var _videoJs = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null); | ||
listeners = [], | ||
// creates and tracks a player listener if the player looks alive | ||
healthcheck = function(type, fn) { | ||
var check = function() { | ||
// playback isn't expected if the player is paused, shut | ||
// down monitoring | ||
if (player.paused()) { | ||
return cleanup(); | ||
} | ||
// playback isn't expected once the video has ended | ||
if (player.ended()) { | ||
return cleanup(); | ||
} | ||
fn.call(this); | ||
}; | ||
player.on(type, check); | ||
listeners.push([type, check]); | ||
}, | ||
// clear any previously registered listeners | ||
cleanup = function() { | ||
var listener; | ||
while (listeners.length) { | ||
listener = listeners.shift(); | ||
player.off(listener[0], listener[1]); | ||
} | ||
window.clearTimeout(monitor); | ||
}; | ||
var _videoJs2 = _interopRequireDefault(_videoJs); | ||
player.on('play', function() { | ||
var lastTime = 0; | ||
// Default options for the plugin. | ||
var defaults = { | ||
header: '', | ||
code: '', | ||
message: '', | ||
timeout: 45 * 1000, | ||
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' | ||
} | ||
} | ||
}; | ||
cleanup(); | ||
/** | ||
* Monitors a player for signs of life during playback and | ||
* triggers PLAYER_ERR_TIMEOUT if none occur within a reasonable | ||
* timeframe. | ||
*/ | ||
var monitorPlayback = function monitorPlayback(player, options) { | ||
var monitor = undefined; | ||
// if no playback is detected for long enough, trigger a timeout error | ||
resetMonitor(); | ||
healthcheck('timeupdate', function() { | ||
var currentTime = player.currentTime(); | ||
if (currentTime !== lastTime) { | ||
lastTime = currentTime; | ||
resetMonitor(); | ||
} | ||
}); | ||
healthcheck('progress', resetMonitor); | ||
// clears the previous monitor timeout and sets up a new one | ||
var resetMonitor = function resetMonitor() { | ||
window.clearTimeout(monitor); | ||
monitor = window.setTimeout(function () { | ||
if (player.error() || player.paused() || player.ended()) { | ||
// never overwrite existing errors or display a new one | ||
// if the player is paused or ended. | ||
return; | ||
} | ||
player.error({ | ||
code: -2, | ||
type: 'PLAYER_ERR_TIMEOUT' | ||
}); | ||
}, options.timeout); | ||
player.on('dispose', function() { | ||
cleanup(); | ||
}); | ||
}, | ||
// shim in IE8 event listener support | ||
on = function(elem, type, fn) { | ||
if (elem.addEventListener) { | ||
elem.addEventListener(type, fn, false); | ||
} else { | ||
elem.attachEvent('on' + type, fn); | ||
// clear out any existing player timeout | ||
if (player.error() && player.error().code === -2) { | ||
player.error(null); | ||
} | ||
}; | ||
var listeners = []; | ||
// clear any previously registered listeners | ||
var cleanup = function cleanup() { | ||
var listener = undefined; | ||
while (listeners.length) { | ||
listener = listeners.shift(); | ||
player.off(listener[0], listener[1]); | ||
} | ||
window.clearTimeout(monitor); | ||
}; | ||
// creates and tracks a player listener if the player looks alive | ||
var healthcheck = function healthcheck(type, fn) { | ||
var check = function check() { | ||
// playback isn't expected if the player is paused, shut | ||
// down monitoring | ||
if (player.paused()) { | ||
return cleanup(); | ||
} | ||
// playback isn't expected once the video has ended | ||
if (player.ended()) { | ||
return cleanup(); | ||
} | ||
fn.call(this); | ||
}; | ||
// Setup Custom Error Conditions | ||
var initCustomErrorConditions = function(player, options) { | ||
player.on(type, check); | ||
listeners.push([type, check]); | ||
}; | ||
// PLAYER_ERR_TIMEOUT | ||
monitorPlayback(player, options); | ||
player.on('play', function () { | ||
var lastTime = 0; | ||
// PLAYER_ERR_NO_SRC | ||
player.on('play', function() { | ||
if (player.currentSrc() === null || | ||
player.currentSrc() === undefined || | ||
player.currentSrc() === '') { | ||
player.error({ | ||
code: -1, | ||
type: 'PLAYER_ERR_NO_SRC' | ||
}); | ||
cleanup(); | ||
// if no playback is detected for long enough, trigger a timeout error | ||
resetMonitor(); | ||
healthcheck('timeupdate', function () { | ||
var currentTime = player.currentTime(); | ||
if (currentTime !== lastTime) { | ||
lastTime = currentTime; | ||
resetMonitor(); | ||
} | ||
}); | ||
}; | ||
healthcheck('progress', resetMonitor); | ||
}); | ||
videojs.plugin('errors', function(options){ | ||
var | ||
player = this, | ||
// Merge the external and default settings | ||
settings = videojs.mergeOptions(defaults, options); | ||
player.on('dispose', function () { | ||
cleanup(); | ||
}); | ||
}; | ||
player.ready(function() { | ||
// Setup Custom Error Conditions | ||
var initCustomErrorConditions = function initCustomErrorConditions(player, options) { | ||
// Add to the error dialog when an error occurs | ||
this.on('error', function() { | ||
var code, error, display, details = ''; | ||
// PLAYER_ERR_TIMEOUT | ||
monitorPlayback(player, options); | ||
error = this.error(); | ||
// PLAYER_ERR_NO_SRC | ||
player.on('play', function () { | ||
if (!player.currentSrc()) { | ||
player.error({ | ||
code: -1, | ||
type: 'PLAYER_ERR_NO_SRC' | ||
}); | ||
} | ||
}); | ||
}; | ||
// In the rare case when `error()` does not return an error object, | ||
// defensively escape the handler function. | ||
if (!error) { | ||
return; | ||
} | ||
/** | ||
* Set up the plugin. | ||
*/ | ||
var onPlayerReady = function onPlayerReady(player, options) { | ||
error = videojs.mergeOptions(error, settings.errors[error.code || 0]); | ||
player.addClass('vjs-errors'); | ||
if (error.message) { | ||
details = '<div class="vjs-errors-details">' + this.localize('Technical details') + | ||
': <div class="vjs-errors-message">' + this.localize(error.message) + '</div>' + | ||
'</div>'; | ||
} | ||
// Add to the error dialog when an error occurs | ||
player.on('error', function () { | ||
var display = undefined; | ||
var details = ''; | ||
var error = player.error(); | ||
var content = document.createElement('div'); | ||
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 = _videoJs2['default'].mergeOptions(error, options.errors[error.code || 0]); | ||
if (player.width() <= 600 || player.height() <= 250) { | ||
display.addClass('vjs-xs'); | ||
} | ||
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>'; | ||
} | ||
on(display.el().querySelector('.vjs-errors-close-button'), 'click', function() { | ||
display.hide(); | ||
}); | ||
on(display.el().querySelector('.vjs-errors-ok-button'), 'click', function() { | ||
display.hide(); | ||
}); | ||
}); | ||
display = player.errorDisplay; | ||
// Initialize custom error conditions | ||
initCustomErrorConditions(this, settings); | ||
content.className = 'vjs-errors-dialog'; | ||
content.innerHTML = '<button class="vjs-errors-close-button"></button>\n <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>\n <div class="vjs-errors-ok-button-container">\n <button class="vjs-errors-ok-button">' + this.localize('OK') + '</button>\n </div>'; | ||
display.fillWith(content); | ||
if (player.width() <= 600 || player.height() <= 250) { | ||
display.addClass('vjs-xs'); | ||
} | ||
var closeButton = display.el().querySelector('.vjs-errors-close-button'); | ||
var okButton = display.el().querySelector('.vjs-errors-ok-button'); | ||
_videoJs2['default'].on(closeButton, 'click', function () { | ||
display.close(); | ||
}); | ||
_videoJs2['default'].on(okButton, 'click', function () { | ||
display.close(); | ||
}); | ||
}); | ||
})(); | ||
// Initialize custom error conditions | ||
initCustomErrorConditions(player, options); | ||
}; | ||
/** | ||
* Initialize the plugin. Waits until the player is ready to do anything. | ||
*/ | ||
var errors = function errors(options) { | ||
var _this = this; | ||
this.ready(function () { | ||
onPlayerReady(_this, _videoJs2['default'].mergeOptions(defaults, options)); | ||
}); | ||
}; | ||
// Register the plugin with video.js. | ||
_videoJs2['default'].plugin('errors', errors); | ||
exports['default'] = errors; | ||
module.exports = exports['default']; | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{}]},{},[1])(1) | ||
}); |
@@ -1,3 +0,7 @@ | ||
/*! 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.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)})})}(); | ||
/** | ||
* videojs-errors | ||
* @version 1.0.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,r){function t(d,s){if(!n[d]){if(!o[d]){var a="function"==typeof require&&require;if(!s&&a)return a(d,!0);if(i)return i(d,!0);var l=new Error("Cannot find module '"+d+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[d]={exports:{}};o[d][0].call(u.exports,function(e){var n=o[d][1][e];return t(n?n:e)},u,u.exports,e,o,n,r)}return n[d].exports}for(var i="function"==typeof require&&require,d=0;d<r.length;d++)t(r[d]);return t}({1:[function(e,o,n){(function(e){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var t="undefined"!=typeof window?window.videojs:"undefined"!=typeof e?e.videojs:null,i=r(t),d={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"}}},s=function(e,o){var n=void 0,r=function(){window.clearTimeout(n),n=window.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)},t=[],i=function(){for(var o=void 0;t.length;)o=t.shift(),e.off(o[0],o[1]);window.clearTimeout(n)},d=function(o,n){var r=function(){return e.paused()?i():e.ended()?i():void n.call(this)};e.on(o,r),t.push([o,r])};e.on("play",function(){var o=0;i(),r(),d("timeupdate",function(){var n=e.currentTime();n!==o&&(o=n,r())}),d("progress",r)}),e.on("dispose",function(){i()})},a=function(e,o){s(e,o),e.on("play",function(){e.currentSrc()||e.error({code:-1,type:"PLAYER_ERR_NO_SRC"})})},l=function(e,o){e.addClass("vjs-errors"),e.on("error",function(){var n=void 0,r="",t=e.error(),d=document.createElement("div");if(t){t=i["default"].mergeOptions(t,o.errors[t.code||0]),t.message&&(r='<div class="vjs-errors-details">'+e.localize("Technical details")+'\n : <div class="vjs-errors-message">'+e.localize(t.message)+"</div>\n </div>"),n=e.errorDisplay,d.className="vjs-errors-dialog",d.innerHTML='<button class="vjs-errors-close-button"></button>\n <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 "+r+'\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(d),(e.width()<=600||e.height()<=250)&&n.addClass("vjs-xs");var s=n.el().querySelector(".vjs-errors-close-button"),a=n.el().querySelector(".vjs-errors-ok-button");i["default"].on(s,"click",function(){n.close()}),i["default"].on(a,"click",function(){n.close()})}}),a(e,o)},u=function(e){var o=this;this.ready(function(){l(o,i["default"].mergeOptions(d,e))})};i["default"].plugin("errors",u),n["default"]=u,o.exports=n["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)}); |
126
package.json
{ | ||
"name": "videojs-errors", | ||
"version": "1.0.0", | ||
"version": "1.0.2", | ||
"author": "Brightcove", | ||
@@ -8,7 +8,8 @@ "description": "A VideoJS plugin for custom error reporting", | ||
"keywords": [ | ||
"videojs", | ||
"flash", | ||
"html5", | ||
"flash", | ||
"player", | ||
"video", | ||
"player" | ||
"videojs", | ||
"videojs-plugin" | ||
], | ||
@@ -20,22 +21,103 @@ "repository": { | ||
"scripts": { | ||
"test": "grunt test", | ||
"version": "grunt && git add dist", | ||
"postversion": "git push && git push --tags" | ||
"prebuild": "npm run clean", | ||
"build": "npm-run-all -p build:*", | ||
"build:css": "npm-run-all mkdirs build:css:sass build:css:bannerize", | ||
"build:css:bannerize": "bannerize dist/videojs-errors.css --banner=scripts/banner.ejs", | ||
"build:css:sass": "node-sass --output-style=compressed --linefeed=lf src/plugin.scss -o dist && mv dist/plugin.css dist/videojs-errors.css", | ||
"build:js": "npm-run-all mkdirs build:js:babel build:js:browserify build:js:bannerize build:js:uglify", | ||
"build:js:babel": "babel src -d es5", | ||
"build:js:bannerize": "bannerize dist/videojs-errors.js --banner=scripts/banner.ejs", | ||
"build:js:browserify": "browserify . -s videojs-errors -o dist/videojs-errors.js", | ||
"build:js:uglify": "uglifyjs dist/videojs-errors.js --comments --mangle --compress -o dist/videojs-errors.min.js", | ||
"build:lang": "vjslang --dir dist/lang", | ||
"build:test": "npm-run-all mkdirs build:test:browserify", | ||
"build:test:browserify": "browserify `find test -name '*.test.js'` -t babelify -o dist-test/videojs-errors.js", | ||
"clean": "rm -rf dist dist-test es5", | ||
"lint": "vjsstandard", | ||
"mkdirs": "mkdir -p dist dist-test es5", | ||
"prestart": "npm run build", | ||
"start": "npm-run-all -p start:serve watch", | ||
"start:serve": "babel-node scripts/server.js", | ||
"pretest": "npm-run-all lint build:test", | ||
"test": "karma start test/karma/detected.js", | ||
"test:chrome": "npm run pretest && karma start test/karma/chrome.js", | ||
"test:firefox": "npm run pretest && karma start test/karma/firefox.js", | ||
"test:ie": "npm run pretest && karma start test/karma/ie.js", | ||
"test:safari": "npm run pretest && karma start test/karma/safari.js", | ||
"preversion": "npm test", | ||
"version": "node scripts/npm-version-for-bower.js", | ||
"postversion": "git reset --hard HEAD~1", | ||
"watch": "npm run mkdirs && npm-run-all -p watch:*", | ||
"watch:css": "node-sass --output-style=nested --linefeed=lf src/plugin.scss -o dist -w src && mv dist/plugin.css dist/videojs-errors.css", | ||
"watch:js": "watchify src/plugin.js -t babelify -v -o dist/videojs-errors.js", | ||
"watch:test": "watchify `find test -name '*.test.js'` -t babelify -o dist-test/videojs-errors.js", | ||
"prepublish": "npm run build" | ||
}, | ||
"dependencies": {}, | ||
"dependencies": { | ||
"video.js": "^5.5.1" | ||
}, | ||
"devDependencies": { | ||
"grunt": "^0.4.4", | ||
"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": "^5.2.1" | ||
} | ||
"babel": "^5.8.0", | ||
"babelify": "^6.0.0", | ||
"bannerize": "^1.0.0", | ||
"browserify": "^11.0.0", | ||
"browserify-shim": "^3.0.0", | ||
"connect": "^3.4.0", | ||
"cowsay": "^1.1.0", | ||
"global": "^4.3.0", | ||
"karma": "^0.13.0", | ||
"karma-browserify": "^4.4.0", | ||
"karma-chrome-launcher": "^0.2.0", | ||
"karma-detect-browsers": "^2.0.0", | ||
"karma-firefox-launcher": "^0.1.0", | ||
"karma-ie-launcher": "^0.2.0", | ||
"karma-qunit": "^0.1.0", | ||
"karma-safari-launcher": "^0.1.0", | ||
"lodash-compat": "^3.10.0", | ||
"minimist": "^1.2.0", | ||
"node-sass": "^3.4.0", | ||
"npm-run-all": "~1.2.0", | ||
"portscanner": "^1.0.0", | ||
"qunitjs": "^1.0.0", | ||
"serve-static": "^1.10.0", | ||
"shelljs": "^0.5.3", | ||
"sinon": "^1.0.0", | ||
"uglify-js": "^2.5.0", | ||
"videojs-languages": "^1.0.0", | ||
"videojs-standard": "^4.0.0", | ||
"watchify": "^3.6.0" | ||
}, | ||
"main": "es5/plugin.js", | ||
"browserify": { | ||
"transform": [ | ||
"browserify-shim" | ||
] | ||
}, | ||
"browserify-shim": { | ||
"qunit": "global:QUnit", | ||
"sinon": "global:sinon", | ||
"video.js": "global:videojs" | ||
}, | ||
"vjsstandard": { | ||
"ignore": [ | ||
"dist", | ||
"dist-test", | ||
"docs", | ||
"es5", | ||
"test/karma", | ||
"scripts" | ||
] | ||
}, | ||
"files": [ | ||
"CONTRIBUTING.md", | ||
"bower.json", | ||
"dist-test/", | ||
"dist/", | ||
"docs/", | ||
"es5/", | ||
"index.html", | ||
"scripts/", | ||
"src/", | ||
"test/" | ||
] | ||
} |
@@ -1,3 +0,3 @@ | ||
Video.js Error Messages | ||
======================= | ||
# videojs-errors | ||
[![Build Status](https://travis-ci.org/brightcove/videojs-errors.svg?branch=master)](https://travis-ci.org/brightcove/videojs-errors) | ||
@@ -7,4 +7,18 @@ | ||
Using the Plugin | ||
---------------- | ||
### Table of Contents | ||
<!-- START doctoc generated TOC please keep comment here to allow auto update --> | ||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> | ||
- [Getting Started](#getting-started) | ||
- [Localization](#localization) | ||
- [Supported Errors](#supported-errors) | ||
- [Custom Errors](#custom-errors) | ||
- [Known Issues](#known-issues) | ||
<!-- END doctoc generated TOC please keep comment here to allow auto update --> | ||
## Getting Started | ||
The plugin automatically registers itself when you include videojs.errors.js in your page: | ||
@@ -27,3 +41,3 @@ | ||
``` | ||
**Note:** A formatted example is available for Spanish under 'lang/es.js'. | ||
@@ -43,3 +57,3 @@ | ||
Additionally, 2 custom error scenarios have been added as reference for future extension. | ||
Additionally, 2 custom error scenarios have been added as reference for future extension. | ||
@@ -49,3 +63,3 @@ - PLAYER_ERR_NO_SRC (numeric value `-1`) | ||
NOTES: | ||
NOTES: | ||
@@ -73,9 +87,4 @@ - Custom error definitions should be limited to the initCustomErrorConditions routine for encapsulation. | ||
Known Issues | ||
------------ | ||
## Known Issues | ||
On iPhones, the video element intercepts all user interaction so error message dialogs miss the tap events and don't dismiss themselves. If your video is busted anyways, you may not be that upset about this. | ||
## Release History | ||
- 0.1.8: Fixes a bug with dispose() and fixes playback monitor when ended/paused | ||
- 0.1.0: Initial release |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
76505
29
1525
86
1
29
2
7
2
+ Addedvideo.js@^5.5.1
+ Addedbabel-runtime@6.26.0(transitive)
+ Addedcore-js@2.6.12(transitive)
+ Addeddom-walk@0.1.2(transitive)
+ Addedes5-shim@4.6.7(transitive)
+ Addedglobal@4.3.04.4.0(transitive)
+ Addedindividual@2.0.0(transitive)
+ Addedis-function@1.0.2(transitive)
+ Addedmin-document@2.19.0(transitive)
+ Addedparse-headers@2.0.5(transitive)
+ Addedprocess@0.11.100.5.2(transitive)
+ Addedregenerator-runtime@0.11.1(transitive)
+ Addedrust-result@1.0.0(transitive)
+ Addedsafe-json-parse@4.0.0(transitive)
+ Addedtsml@1.0.1(transitive)
+ Addedvideo.js@5.20.5(transitive)
+ Addedvideojs-font@2.0.0(transitive)
+ Addedvideojs-ie8@1.1.2(transitive)
+ Addedvideojs-swf@5.4.1(transitive)
+ Addedvideojs-vtt.js@0.12.6(transitive)
+ Addedxhr@2.2.2(transitive)
+ Addedxtend@4.0.2(transitive)