forked from 0x2620/pandora
fix embed player(subtitles)
This commit is contained in:
parent
32a558c48d
commit
5bd0fde709
1 changed files with 15 additions and 1 deletions
|
@ -102,7 +102,7 @@ pandora.ui.embedPlayer = function() {
|
|||
resolution: ui.videoResolution,
|
||||
scaleToFill: ui.videoScale == 'fill',
|
||||
showIconOnLoad: true,
|
||||
subtitles: video.subtitles,
|
||||
subtitles: getSubtitles(options),
|
||||
timeline: options.playInToOut ? function(size, i) {
|
||||
return pandora.getMediaURL('/' + options.item
|
||||
+ '/timelineantialias'
|
||||
|
@ -335,6 +335,20 @@ 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));
|
||||
|
|
Loading…
Reference in a new issue