pandora/static/js/player.js

179 lines
7.4 KiB
JavaScript
Raw Normal View History

2012-04-17 06:31:44 +00:00
'use strict';
pandora.ui.player = function(data) {
2012-06-15 13:20:35 +00:00
var ui = pandora.user.ui,
2013-10-22 14:45:39 +00:00
that = Ox.VideoPlayerPanel({
2012-06-15 13:20:35 +00:00
annotationsCalendarSize: ui.annotationsCalendarSize,
annotationsMapSize: ui.annotationsMapSize,
annotationsRange: ui.annotationsRange,
annotationsSize: ui.annotationsSize,
annotationsSort: ui.annotationsSort,
2014-02-14 15:23:59 +00:00
annotationsTooltip: Ox._('annotations')
2014-09-25 19:56:19 +00:00
+ ' <span class="OxBright">' + Ox.SYMBOLS.shift + 'A</span>',
audioTrack: data.audioTrack,
2012-06-15 13:20:35 +00:00
censored: data.censored,
censoredIcon: pandora.site.cantPlay.icon,
2014-02-14 15:23:59 +00:00
censoredTooltip: Ox._(pandora.site.cantPlay.text),
2012-06-15 13:20:35 +00:00
clickLink: pandora.clickLink,
cuts: data.cuts || [],
duration: data.duration,
2017-11-04 09:53:27 +00:00
enableDownload: pandora.hasCapability('canDownloadVideo') >= data.rightslevel,
2012-06-15 13:20:35 +00:00
enableSubtitles: ui.videoSubtitles,
find: ui.itemFind,
getLargeTimelineURL: function(type, i) {
return pandora.getMediaURL(
2017-06-06 08:06:27 +00:00
'/' + ui.item + '/timeline' + type + '64p' + i + '.jpg?' + data.modified
);
2012-06-15 13:20:35 +00:00
},
height: pandora.$ui.contentPanel.size(1),
'in': ui.videoPoints[ui.item]['in'],
2014-01-19 06:28:05 +00:00
itemName: pandora.site.itemName,
2012-06-15 13:20:35 +00:00
layers: data.annotations,
2013-08-01 08:37:17 +00:00
loop: ui.videoLoop,
2012-06-15 13:20:35 +00:00
muted: ui.videoMuted,
out: ui.videoPoints[ui.item].out,
position: ui.videoPoints[ui.item].position,
resolution: ui.videoResolution,
scaleToFill: ui.videoScale == 'fill',
selected: ui.videoPoints[ui.item].annotation
? ui.item + '/' + ui.videoPoints[ui.item].annotation
: '',
showAnnotations: ui.showAnnotations,
showAnnotationsCalendar: ui.showAnnotationsCalendar,
showAnnotationsMap: ui.showAnnotationsMap,
showLayers: Ox.clone(ui.showLayers),
showUsers: pandora.site.annotations.showUsers,
showTimeline: ui.showTimeline,
2017-06-06 08:06:27 +00:00
smallTimelineURL: pandora.getMediaURL('/' + ui.item + '/timeline16p.jpg?' + data.modified),
2021-06-03 16:32:01 +00:00
subtitles: data.subtitles || [],
subtitlesDefaultTrack: data.subtitlesDefaultTrack || Ox.getLanguageNameByCode(pandora.site.language),
subtitlesLayer: data.subtitlesLayer,
2015-04-14 14:53:47 +00:00
subtitlesOffset: ui.videoSubtitlesOffset,
2021-06-03 16:32:01 +00:00
subtitlesTrack: data.subtitlesTrack || Ox.getLanguageNameByCode(pandora.site.language),
2012-06-15 13:20:35 +00:00
timeline: ui.videoTimeline,
2014-09-25 19:56:19 +00:00
timelineTooltip: Ox._('timeline') + ' <span class="OxBright">' + Ox.SYMBOLS.shift + 'T</span>',
2012-06-15 13:20:35 +00:00
video: data.video,
volume: ui.videoVolume,
width: Ox.$document.width() - pandora.$ui.mainPanel.size(0) - 1
2012-06-15 13:20:35 +00:00
}).bindEvent({
annotationsrange: function(data) {
pandora.UI.set({annotationsRange: data.range});
},
annotationssize: function(data) {
pandora.UI.set({annotationsSize: data.size});
},
annotationssort: function(data) {
pandora.UI.set({annotationsSort: data.sort});
},
censored: function() {
that.options('fullscreen') && that.options({
fullscreen: false
});
pandora.URL.push(pandora.site.cantPlay.link);
},
2013-07-14 16:38:15 +00:00
copy: function(data) {
pandora.clipboard.copy(data.map(function(clip) {
2013-08-02 19:38:18 +00:00
return clip.annotation || ui.item + '/' + clip['in'] + '-' + clip.out;
2013-07-14 16:38:15 +00:00
}), 'clip');
},
copyadd: function(data) {
pandora.clipboard.add(data.map(function(clip) {
2013-08-02 19:38:18 +00:00
return clip.annotation || ui.item + '/' + clip['in'] + '-' + clip.out;
2013-07-14 16:38:15 +00:00
}), 'clip');
},
downloadvideo: function() {
document.location.href = pandora.getDownloadLink(ui.item, data.rightslevel);
2012-06-15 13:20:35 +00:00
},
find: function(data) {
2013-07-14 15:36:49 +00:00
pandora.UI.set({itemFind: data.find});
2012-06-15 13:20:35 +00:00
},
gainfocus: function() {
pandora.$ui.mainMenu.replaceItemMenu();
},
2012-06-15 13:20:35 +00:00
info: function(data) {
pandora.ui.annotationDialog(
Ox.getObjectById(pandora.site.layers, data.layer).title
).open();
},
2013-08-01 08:37:17 +00:00
loop: function(data) {
pandora.UI.set({videoLoop: data.loop});
},
2012-06-15 13:20:35 +00:00
muted: function(data) {
2013-07-14 15:36:49 +00:00
pandora.UI.set({videoMuted: data.muted});
2012-06-15 13:20:35 +00:00
},
2013-07-08 12:40:51 +00:00
playing: function(data) {
pandora.UI.set(
'videoPoints.' + ui.item + '.position',
data.position
);
},
2013-07-14 16:38:15 +00:00
points: function(data) {
pandora.UI.set('videoPoints.' + ui.item, {
annotation: ui.videoPoints[ui.item].annotation,
'in': data['in'],
out: data.out,
position: data.position
});
},
2012-06-15 13:20:35 +00:00
position: function(data) {
pandora.UI.set(
'videoPoints.' + ui.item + '.position',
data.position
);
},
resizeannotations: function(data) {
2013-07-14 15:36:49 +00:00
pandora.UI.set({annotationsSize: data.annotationsSize});
2012-06-15 13:20:35 +00:00
},
resizecalendar: function(data) {
2013-07-14 15:36:49 +00:00
pandora.UI.set({annotationsCalendarSize: data.size});
2012-06-15 13:20:35 +00:00
},
resizemap: function(data) {
2013-07-14 15:36:49 +00:00
pandora.UI.set({annotationsMapSize: data.size});
2012-06-15 13:20:35 +00:00
},
resolution: function(data) {
2013-07-14 15:36:49 +00:00
pandora.UI.set({videoResolution: data.resolution});
2012-06-15 13:20:35 +00:00
},
scale: function(data) {
2013-07-14 15:36:49 +00:00
pandora.UI.set({videoScale: data.scale});
2012-06-15 13:20:35 +00:00
},
select: function(data) {
pandora.UI.set('videoPoints.' + ui.item + '.annotation', data.id.split('/')[1] || '');
2012-06-15 13:20:35 +00:00
},
subtitles: function(data) {
2013-07-14 15:36:49 +00:00
pandora.UI.set({videoSubtitles: data.subtitles});
2012-06-15 13:20:35 +00:00
},
toggleannotations: function(data) {
2013-07-14 15:36:49 +00:00
pandora.UI.set({showAnnotations: data.showAnnotations});
2012-06-15 13:20:35 +00:00
},
togglelayer: function(data) {
pandora.UI.set('showLayers.' + data.layer, !data.collapsed);
},
togglemap: function(data) {
2013-07-14 15:36:49 +00:00
pandora.UI.set({showAnnotationsMap: !data.collapsed});
2012-06-15 13:20:35 +00:00
},
togglesize: function(data) {
pandora.UI.set({videoSize: data.size});
},
toggletimeline: function(data) {
2013-07-14 15:36:49 +00:00
pandora.UI.set({showTimeline: data.showTimeline});
2012-06-15 13:20:35 +00:00
},
volume: function(data) {
2013-07-14 15:36:49 +00:00
pandora.UI.set({videoVolume: data.volume});
2012-06-15 13:20:35 +00:00
},
pandora_showannotations: function(data) {
that.options({showAnnotations: data.value});
},
pandora_showtimeline: function(data) {
that.options({showTimeline: data.value});
},
pandora_videotimeline: function(data) {
that.options({timeline: data.value});
}
});
return that;
2012-04-17 06:31:44 +00:00
2012-05-17 09:38:59 +00:00
};