videojs-errors
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -9,2 +9,5 @@ CHANGELOG | ||
## 1.3.0 (2017-04-18) | ||
* @misteroneill Add new custom errors and an `extend` method to customize errors at runtime ([#90](https://github.com/brightcove/videojs-errors/pull/90)) | ||
## 1.2.0 (2017-02-21) | ||
@@ -11,0 +14,0 @@ * @gfviegas Add support for Portuguese ([#42](https://github.com/brightcove/videojs-errors/pull/42)) |
129
package.json
{ | ||
"name": "videojs-errors", | ||
"version": "1.2.0", | ||
"author": "Brightcove", | ||
"description": "A VideoJS plugin for custom error reporting", | ||
"version": "1.3.0", | ||
"author": "Brightcove, Inc.", | ||
"description": "A Video.js plugin for custom error reporting", | ||
"license": "Apache-2.0", | ||
@@ -20,103 +20,42 @@ "keywords": [ | ||
"scripts": { | ||
"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.conf.js", | ||
"test:chrome": "npm run pretest && karma start test/karma.conf.js --browsers Chrome", | ||
"test:firefox": "npm run pretest && karma start test/karma.conf.js --browsers Firefox", | ||
"test:ie": "npm run pretest && karma start test/karma.conf.js --browsers IE", | ||
"test:safari": "npm run pretest && karma start test/karma.conf.js --browsers Safari", | ||
"build": "sb-build", | ||
"clean": "sb-clean", | ||
"lint": "sb-lint", | ||
"start": "sb-start", | ||
"test": "sb-test", | ||
"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" | ||
"postversion": "sb-release", | ||
"prepush": "npm run lint" | ||
}, | ||
"dependencies": { | ||
"video.js": "^5.5.1", | ||
"global": "^4.3.0" | ||
"global": "^4.3.0", | ||
"video.js": "^5.16.0" | ||
}, | ||
"devDependencies": { | ||
"babel": "^5.8.0", | ||
"babelify": "^6.0.0", | ||
"bannerize": "^1.0.0", | ||
"browserify": "^13.3.0", | ||
"browserify-shim": "^3.0.0", | ||
"connect": "^3.4.0", | ||
"cowsay": "^1.1.0", | ||
"karma": "^1.4.1", | ||
"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": "^4.5.0", | ||
"npm-run-all": "~3.1.2", | ||
"portscanner": "^2.1.1", | ||
"qunitjs": "^1.0.0", | ||
"serve-static": "^1.10.0", | ||
"shelljs": "^0.5.3", | ||
"sinon": "1.14.1", | ||
"uglify-js": "^2.5.0", | ||
"videojs-languages": "^1.0.0", | ||
"videojs-standard": "^4.0.0", | ||
"watchify": "^3.6.0" | ||
"husky": "^0.13.1", | ||
"videojs-spellbook": "^3.1.3" | ||
}, | ||
"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.conf.js", | ||
"scripts" | ||
] | ||
}, | ||
"main": "dist/es5/index.js", | ||
"files": [ | ||
"CHANGELOG.md", | ||
"CONTRIBUTING.md", | ||
"bower.json", | ||
"dist-test/", | ||
"dist/", | ||
"README.md", | ||
"dist/browser", | ||
"dist/docs", | ||
"dist/es5", | ||
"dist/lang", | ||
"docs/", | ||
"es5/", | ||
"index.html", | ||
"scripts/", | ||
"src/", | ||
"test/" | ||
] | ||
} | ||
"src/" | ||
], | ||
"jsnext:main": "src/js/index.js", | ||
"engines": { | ||
"node": ">=4.4.0" | ||
}, | ||
"generator-videojs-plugin": { | ||
"version": "3.2.0" | ||
}, | ||
"spellbook": { | ||
"ie8": true | ||
} | ||
} |
@@ -5,3 +5,3 @@ # videojs-errors | ||
A plugin that displays user-friendly messages when video.js encounters an error. | ||
A plugin that displays user-friendly messages when Video.js encounters an error. | ||
@@ -26,7 +26,11 @@ ### Table of Contents | ||
<script src='videojs.errors.js'></script> | ||
```html | ||
<script src="videojs.errors.js"></script> | ||
``` | ||
You probably want to include the default stylesheet, too. It displays error messages as a semi-transparent overlay on top of the video element itself. It's designed to match up fairly well with the default video.js styles: | ||
You probably want to include the default stylesheet, too. It displays error messages as a semi-transparent overlay on top of the video element itself. It's designed to match up fairly well with the default Video.js styles: | ||
<link href='videojs.errors.css' rel='stylesheet'> | ||
```html | ||
<link href="videojs.errors.css" rel="stylesheet"> | ||
``` | ||
@@ -39,4 +43,4 @@ If you're not a fan of the default styling, you can drop in your own stylesheet. The only new element to worry about is `vjs-errors-dialog` which is the container for the error messages. | ||
```html | ||
<script src='videojs.errors.js'></script> | ||
<script src='lang/es.js'></script> | ||
<script src="videojs.errors.js"></script> | ||
<script src="lang/es.js"></script> | ||
``` | ||
@@ -48,3 +52,3 @@ | ||
Once you've initialized video.js, you can activate the errors plugin. The plugin has a set of default error messages for the standard HTML5 video errors keyed off their runtime values: | ||
Once you've initialized Video.js, you can activate the errors plugin. The plugin has a set of default error messages for the standard HTML5 video errors keyed off their runtime values: | ||
@@ -59,12 +63,14 @@ - MEDIA_ERR_ABORTED (numeric value `1`) | ||
Additionally, 2 custom error scenarios have been added as reference for future extension. | ||
Additionally, some custom errors have been added as reference for future extension. | ||
- PLAYER_ERR_NO_SRC (numeric value `-1`) | ||
- PLAYER_ERR_TIMEOUT (numeric value `-2`) | ||
- PLAYER_ERR_DOMAIN_RESTRICTED (numeric value `-3`) | ||
- PLAYER_ERR_IP_RESTRICTED (numeric value `-4`) | ||
- PLAYER_ERR_GEO_RESTRICTED (numeric value `-5`) | ||
NOTES: | ||
**Note:** | ||
- Custom error definitions should be limited to the initCustomErrorConditions routine for encapsulation. | ||
- Custom errors should reference a code value of a negative integer. | ||
- Custom errors should reference a type beginning with 'PLAYER_ERR' versus the standardized 'MEDIA_ERR' to avoid confusion. | ||
- Custom errors should reference a type beginning with `PLAYER_ERR` versus the standardized `MEDIA_ERR` to avoid confusion. | ||
- Custom errors can be chosen to be dismissible (boolean value `true`) | ||
@@ -74,15 +80,36 @@ | ||
video.errors({ | ||
errors: { | ||
3: { | ||
headline: 'This is an override for the generic MEDIA_ERR_DECODE', | ||
message: 'This is a custom error message' | ||
} | ||
} | ||
}); | ||
```js | ||
player.errors({ | ||
errors: { | ||
3: { | ||
headline: 'This is an override for the generic MEDIA_ERR_DECODE', | ||
message: 'This is a custom error message' | ||
} | ||
} | ||
}); | ||
``` | ||
If you define custom error messages, you'll need to let video.js know when to emit them yourself: | ||
Or by calling `player.errors.extend` _after_ initializing the plugin: | ||
video.error({code: 'custom',dismiss: true}); | ||
```js | ||
player.errors(); | ||
player.errors.extend({ | ||
3: { | ||
headline: 'This is an override for the generic MEDIA_ERR_DECODE', | ||
message: 'This is a custom error message' | ||
}, | ||
foo: { | ||
headline: 'My custom "foo" error', | ||
message: 'A custom "foo" error message.' | ||
} | ||
}); | ||
``` | ||
If you define custom error messages, you'll need to let Video.js know when to emit them yourself: | ||
```js | ||
player.error({code: 'custom', dismiss: true}); | ||
``` | ||
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`. | ||
@@ -89,0 +116,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
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
1154963
2
64
114
1847
3
8
1
Updatedvideo.js@^5.16.0