videojs-errors
Advanced tools
Comparing version 0.1.1 to 0.1.5
@@ -19,3 +19,3 @@ 'use strict'; | ||
dist: { | ||
src: 'lib/**/*.js', | ||
src: 'src/*.js', | ||
dest: 'dist/<%= pkg.name %>.js' | ||
@@ -77,12 +77,13 @@ } | ||
} | ||
}, | ||
vjslanguages: { | ||
defaults: { | ||
files: { | ||
'dist/lang': ['lang/*.json'] | ||
} | ||
} | ||
} | ||
}); | ||
grunt.loadNpmTasks('grunt-contrib-clean'); | ||
grunt.loadNpmTasks('grunt-contrib-concat'); | ||
grunt.loadNpmTasks('grunt-contrib-connect'); | ||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
grunt.loadNpmTasks('grunt-contrib-qunit'); | ||
grunt.loadNpmTasks('grunt-contrib-jshint'); | ||
grunt.loadNpmTasks('grunt-contrib-watch'); | ||
require('load-grunt-tasks')(grunt); | ||
@@ -95,4 +96,5 @@ grunt.registerTask('test', | ||
['test', | ||
'vjslanguages', | ||
'concat', | ||
'uglify']); | ||
}; |
{ | ||
"name": "videojs-errors", | ||
"version": "0.1.1", | ||
"author": "Tom Johnson", | ||
"version": "0.1.5", | ||
"author": "Brightcove", | ||
"description": "A VideoJS plugin for custom error reporting", | ||
@@ -14,2 +14,6 @@ "license": "Apache-2.0", | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/brightcove/videojs-errors.git" | ||
}, | ||
"scripts": { | ||
@@ -28,9 +32,8 @@ "test": "grunt test" | ||
"grunt-contrib-watch": "^0.4", | ||
"grunt-videojs-languages": "0.0.4", | ||
"load-grunt-tasks": "0.6.0", | ||
"qunitjs": "^1.12", | ||
"sinon": "^1.9.1", | ||
"video.js": "git+https://github.com/dmlap/video-js.git#4.5.2-errors" | ||
}, | ||
"peerDependencies": { | ||
"video.js": "^4.5" | ||
"video.js": "^4.7.3" | ||
} | ||
} |
@@ -19,2 +19,12 @@ Video.js Error Messages | ||
### Localization | ||
The plugin supports multiple languages when using Video.JS v4.7.3 or greater. In order to add additional language support, add the language file after your plugin as follows: | ||
```html | ||
<script src='videojs.errors.js'></script> | ||
<script src='lang/es.js'></script> | ||
``` | ||
**Note:** A formatted example is available for Spanish under 'lang/es.js'. | ||
### Supported Errors | ||
@@ -46,5 +56,7 @@ | ||
video.errors({ | ||
messages: { | ||
3: 'This is an override for the generic MEDIA_ERR_DECODE', | ||
'custom': 'This is a custom error message' | ||
errors: { | ||
3: { | ||
headline: 'This is an override for the generic MEDIA_ERR_DECODE', | ||
message: 'This is a custom error message' | ||
} | ||
} | ||
@@ -55,7 +67,3 @@ }); | ||
video.trigger({ | ||
type: 'error', | ||
code: 'custom', | ||
target: video.el() | ||
}); | ||
video.error({code: 'custom'}); | ||
@@ -62,0 +70,0 @@ If an error is emitted that doesn't have an associated key, a generic, catch-all message is displayed. You can override that text by supplying a message for the key `unknown`. |
@@ -1,2 +0,2 @@ | ||
(function(){ | ||
(function(){ | ||
var | ||
@@ -15,7 +15,7 @@ defaults = { | ||
type: 'MEDIA_ERR_NETWORK', | ||
headline: 'The video connection was lost, please confirm you\'re connected to the internet' | ||
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 can\'t be played on your browser' | ||
headline: 'The video is bad or in a format that cannot be played on your browser' | ||
}, | ||
@@ -28,3 +28,3 @@ 4: { | ||
type: 'MEDIA_ERR_ENCRYPTED', | ||
headline: 'The video you\'re trying to watch is encrypted and we don\'t know how to decrypt it' | ||
headline: 'The video you are trying to watch is encrypted and we do not know how to decrypt it' | ||
}, | ||
@@ -161,7 +161,7 @@ unknown: { | ||
error = videojs.util.mergeOptions(settings.errors[this.error().code || 0], this.error()); | ||
error = videojs.util.mergeOptions(this.error(), settings.errors[this.error().code || 0]); | ||
if (error.message) { | ||
details = '<div class="vjs-errors-details">Technical details:' + | ||
'<div class="vjs-errors-message">' + error.message + '</div>' + | ||
details = '<div class="vjs-errors-details">' + this.localize('Technical details') + | ||
': <div class="vjs-errors-message">' + this.localize(error.message) + '</div>' + | ||
'</div>'; | ||
@@ -171,2 +171,3 @@ } | ||
display = this.errorDisplay; | ||
display.el().innerHTML = | ||
@@ -176,8 +177,8 @@ '<div class="vjs-errors-dialog">' + | ||
'<div class="vjs-errors-content-container">' + | ||
'<h2 class="vjs-errors-headline">' + error.headline + '</h2>' + | ||
'<div><b>Error Code: </b>' + (error.type || error.code) + '</div>' + | ||
details + | ||
'<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">OK</button>' + | ||
'<button class="vjs-errors-ok-button">' + this.localize('OK') + '</button>' + | ||
'</div>' + | ||
@@ -184,0 +185,0 @@ '</div>'; |
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
20120
0
13
436
75
0
13
1