fix subtitles in embed player

This commit is contained in:
rolux 2013-02-12 13:31:58 +05:30
parent b94681dcb0
commit cabc68681a

View file

@ -163,7 +163,10 @@ Ox.load('UI', {
function getVideoOptions(data) { function getVideoOptions(data) {
var canPlayClips = data.editable || pandora.site.capabilities.canPlayClips[pandora.user.level] >= data.rightslevel, var canPlayClips = data.editable || pandora.site.capabilities.canPlayClips[pandora.user.level] >= data.rightslevel,
canPlayVideo = data.editable || pandora.site.capabilities.canPlayVideo[pandora.user.level] >= data.rightslevel, canPlayVideo = data.editable || pandora.site.capabilities.canPlayVideo[pandora.user.level] >= data.rightslevel,
options = {}; options = {},
subtitlesLayer = pandora.site.layers.filter(function(layer) {
return layer.isSubtitles;
})[0];
options.censored = canPlayVideo ? [] options.censored = canPlayVideo ? []
: canPlayClips ? ( : canPlayClips ? (
options.subtitles.length options.subtitles.length
@ -200,11 +203,14 @@ Ox.load('UI', {
}); });
}); });
options.posterFrame = data.posterFrame; options.posterFrame = data.posterFrame;
options.subtitles = data.layers.subtitles options.subtitles = subtitlesLayer ? data.layers[subtitlesLayer.id].map(function(subtitle) {
? data.layers.subtitles.map(function(subtitle) { return {
return {'in': subtitle['in'], out: subtitle.out, text: subtitle.value}; id: subtitle.id,
}) 'in': subtitle['in'],
: []; out: subtitle.out,
text: subtitle.value.replace(/\n/g, ' ').replace(/<br\/?>/g, '\n')
};
}) : [];
options.video = {}; options.video = {};
pandora.site.video.resolutions.forEach(function(resolution) { pandora.site.video.resolutions.forEach(function(resolution) {
options.video[resolution] = Ox.range(data.parts).map(function(i) { options.video[resolution] = Ox.range(data.parts).map(function(i) {