Commit 9d23e9fa by Laq Committed by David Baumgold

fixing the duration function so that it wont break the javascript if metadata is not defined

parent 6bc52f07
......@@ -779,12 +779,17 @@ function (VideoPlayer, VideoStorage, i18n) {
function getDuration() {
try {
return moment.duration(this.metadata[this.youtubeId()].duration, moment.ISO_8601).asSeconds();
return moment.duration(this.metadata[this.youtubeId()].duration, moment.ISO_8601).asSeconds();
} catch (err) {
return _.result(this.metadata[this.youtubeId('1.0')], 'duration') || 0;
try{
return _.result(this.metadata[this.youtubeId('1.0')], 'duration');
} catch (err) {
return 0;
}
}
}
/**
* Sets player mode.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment