1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-29 02:57:21 +02:00

@gkatsev added error logging for bad JSON formatting. closes #2113

This commit is contained in:
Gary Katsevman 2015-05-01 13:59:52 -07:00 committed by heff
parent 90b2f5d6ac
commit fd7b997ecd
4 changed files with 12 additions and 5 deletions

View File

@ -24,6 +24,7 @@ CHANGELOG
* @dconnolly exported the missing videojs.plugin function ([view](https://github.com/videojs/video.js/pull/2103))
* @mmcc added back the captions settings styles ([view](https://github.com/videojs/video.js/pull/2112))
* @gkatsev updated the component.js styles to match the new style guide ([view](https://github.com/videojs/video.js/pull/2105))
* @gkatsev added error logging for bad JSON formatting ([view](https://github.com/videojs/video.js/pull/2113))
--------------------

View File

@ -329,6 +329,7 @@ module.exports = function(grunt) {
standalone: 'videojs'
},
banner: license,
transform: ['babelify'],
plugin: [
[ 'browserify-derequire' ]
]

View File

@ -1672,7 +1672,11 @@ class Player extends Component {
if (dataSetup !== null){
// Parse options JSON
// If empty string, make it a parsable json object.
Lib.obj.merge(tagOptions, safeParseTuple(dataSetup || '{}')[1]);
const [err, data] = safeParseTuple(dataSetup || '{}');
if (err) {
Lib.log.error(err);
}
Lib.obj.merge(tagOptions, data);
}
Lib.obj.merge(baseOptions, tagOptions);

View File

@ -104,10 +104,11 @@ class TextTrackSettings extends Component {
}
restoreSettings() {
let values;
try {
values = safeParseTuple(window.localStorage.getItem('vjs-text-track-settings'))[1];
} catch (e) {}
let [err, values] = safeParseTuple(window.localStorage.getItem('vjs-text-track-settings'));
if (err) {
Lib.log.error(err);
}
if (values) {
this.setValues(values);