add embedPlayer, update embedPanel

This commit is contained in:
rolux 2013-02-20 11:28:51 +05:30
parent 2e3aa03c6b
commit 7142095411
2 changed files with 85 additions and 1 deletions

View file

@ -4,7 +4,17 @@ pandora.ui.embedPanel = function() {
if (pandora.user.ui.item) { if (pandora.user.ui.item) {
that = Ox.Element().html('OK'); that = Ox.Element();
pandora.api.get({id: pandora.user.ui.item, keys: [
'duration', 'layers', 'parts', 'posterFrame',
'rightslevel', 'size', 'title', 'videoRatio'
]}, function(result) {
Ox.extend(result.data, pandora.getVideoOptions(result.data));
that.setElement(
pandora.$ui.embedPlayer = pandora.ui.embedPlayer(result.data)
);
});
} else { } else {

View file

@ -0,0 +1,74 @@
pandora.ui.embedPlayer = function(data) {
var options = getOptions(),
that = Ox.VideoPlayer(Ox.extend({
censored: data.censored,
censoredIcon: pandora.site.cantPlay.icon,
censoredTooltip: pandora.site.cantPlay.text,
controlsBottom: ['play', 'volume', 'scale'].concat(
Ox.Fullscreen.available ? ['fullscreen'] : []
).concat(
['timeline', 'position', 'settings']
),
controlsTooltips: {
close: 'Close',
open: 'Watch on ' + pandora.site.site.name
},
controlsTop: (options.showCloseButton ? ['close'] : []).concat(
['title', 'open']
),
duration: data.duration,
enableFullscreen: Ox.Fullscreen.available,
enableKeyboard: true,
enableMouse: true,
enablePosition: true,
enableSubtitles: true,
enableTimeline: true,
enableVolume: true,
height: options.height,
invertHighlight: options.invertHighlight,
paused: options.paused,
playInToOut: options.playInToOut,
position: options.position,
poster: '/' + options.item + '/' + '96p' + (
options.position !== void 0 ? options.position
: options['in'] !== void 0 ? options['in']
: data.posterFrame
) +'.jpg',
resolution: pandora.user.ui.videoResolution,
subtitles: data.subtitles,
timeline: options.playInToOut ? function(size, i) {
return '/' + options.item
+ '/timelineantialias'
+ size + 'p' + i + '.jpg'
} : '/' + options.item + '/' + 'timeline16p.png',
title: result.data.title,
video: data.video,
width: options.width
}, options['in'] ? {
'in': options['in']
} : {}, options.out ? {
out: options.out
} : {}));
function getOptions() {
var defaults = {
height: 144,
invertHighlight: true,
paused: true,
playInToOut: true,
width: 256
},
options = Ox.extend(defaults, pandora.user.ui.hash.query);
if (!options.position) {
options.position = options['in'] || 0;
}
if (!options['in'] && !options.out) {
options.playInToOut = false;
}
return options;
}
return that;
};