before passing subtitles to player, strip newlines, and replace <br>s with newlines

This commit is contained in:
rolux 2012-02-25 10:51:33 +00:00
parent 2f914f16d6
commit 215168b8f5

View file

@ -798,7 +798,12 @@ pandora.getVideoOptions = function(data) {
options = {},
subtitlesLayer = Ox.getObject(pandora.site.layers, 'isSubtitles', true);
options.subtitles = subtitlesLayer ? data.layers[subtitlesLayer.id].map(function(subtitle) {
return {id: subtitle.id, 'in': subtitle['in'], out: subtitle.out, text: subtitle.value};
return {
id: subtitle.id,
'in': subtitle['in'],
out: subtitle.out,
text: subtitle.value.replace(/\n/g, ' ').replace(/<br\/?>/g, '\n')
};
}) : [];
options.censored = canPlayVideo ? []
: canPlayClips ? (