embedTimeline: fix subtitles (fixes #2823)

This commit is contained in:
Will Thompson 2015-08-07 13:42:20 +02:00 committed by j
commit 5418613023
4 changed files with 17 additions and 31 deletions

View file

@ -40,7 +40,7 @@ pandora.ui.embedPlayer = function() {
sizes = getSizes();
options.height = sizes.videoHeight;
video.subtitles = getSubtitles(video);
video.subtitles = pandora.getSubtitles(video);
if (options.title) {
$title = Ox.Element()
@ -339,20 +339,6 @@ pandora.ui.embedPlayer = function() {
return Ox.$('<canvas>').attr({width: width, height: height})[0].toDataURL();
}
function getSubtitles(options) {
return options.subtitlesLayer ? options.annotations.filter(function(layer) {
return layer.id == options.subtitlesLayer;
})[0].items.map(function(subtitle) {
return {
id: subtitle.id,
'in': subtitle['in'],
out: subtitle.out,
text: subtitle.value.replace(/\n/g, ' ').replace(/<br\/?>/g, '\n'),
tracks: subtitle.languages || [Ox.getLanguageNameByCode(pandora.site.language)]
};
}) : [];
}
function selectAnnotation(data) {
if (data.id) {
setPosition(Math.max(data['in'], options['in'] || 0));