From 82fa80a4f93a1f3fcff401ebb560a96dca386c41 Mon Sep 17 00:00:00 2001 From: rolux Date: Tue, 22 Oct 2013 17:42:35 +0000 Subject: [PATCH] fix getting subtitlesLayer --- static/js/utils.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/static/js/utils.js b/static/js/utils.js index 861af7e6..8779d87c 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -1618,15 +1618,19 @@ pandora.getVideoOptions = function(data) { options = {}; options.subtitlesLayer = pandora.site.layers.filter(function(layer) { return layer.isSubtitles; + }).map(function(layer) { + return layer.id; })[0]; - options.subtitles = options.subtitlesLayer ? data.layers[options.subtitlesLayer.id].map(function(subtitle) { - return { - id: subtitle.id, - 'in': subtitle['in'], - out: subtitle.out, - text: subtitle.value.replace(/\n/g, ' ').replace(//g, '\n') - }; - }) : []; + options.subtitles = options.subtitlesLayer + ? data.layers[options.subtitlesLayer].map(function(subtitle) { + return { + id: subtitle.id, + 'in': subtitle['in'], + out: subtitle.out, + text: subtitle.value.replace(/\n/g, ' ').replace(//g, '\n') + }; + }) + : []; options.censored = canPlayVideo ? [] : canPlayClips ? ( options.subtitles.length