embed player: make showLayers an array, acturally hide layers that are not shown, add timeline (type) option

This commit is contained in:
rolux 2013-02-21 12:32:37 +05:30
parent 0dedc7803a
commit 792766a59b
2 changed files with 25 additions and 17 deletions

View file

@ -83,8 +83,10 @@ pandora.ui.embedPanel = function() {
+ '/timelineantialias' + '/timelineantialias'
+ size + 'p' + i + '.jpg' + size + 'p' + i + '.jpg'
} : '/' + options.item + '/' + 'timeline16p.png', } : '/' + options.item + '/' + 'timeline16p.png',
// timelineType: pandora.user.ui.videoTimeline, timelineType: options.showTimeline
// timelineTypes: pandora.site.timelines, ? options.timeline : '',
timelineTypes: options.showTimeline
? pandora.site.timelines : [],
title: video.title, title: video.title,
video: video.video, video: video.video,
volume: pandora.user.ui.videoVolume, volume: pandora.user.ui.videoVolume,
@ -130,7 +132,7 @@ pandora.ui.embedPanel = function() {
position: options.position, position: options.position,
showInToOut: options.playInToOut, showInToOut: options.playInToOut,
subtitles: ui.videoSubtitles ? video.subtitles : [], subtitles: ui.videoSubtitles ? video.subtitles : [],
type: ui.videoTimeline, type: options.timeline,
width: window.innerWidth - 16 width: window.innerWidth - 16
}, options['in'] ? { }, options['in'] ? {
'in': options['in'] 'in': options['in']
@ -151,7 +153,9 @@ pandora.ui.embedPanel = function() {
if (options.showAnnotations) { if (options.showAnnotations) {
if (options.playInToOut) { if (options.playInToOut) {
video.annotations.forEach(function(layer) { video.annotations.forEach(function(layer) {
var items = []; var items;
if (Ox.contains(options.showLayers, layer.id)) {
items = [];
layer.items.forEach(function(item) { layer.items.forEach(function(item) {
if (( if ((
item['in'] >= options['in'] && item['in'] <= options.out item['in'] >= options['in'] && item['in'] <= options.out
@ -162,6 +166,7 @@ pandora.ui.embedPanel = function() {
} }
}); });
layer.items = items; layer.items = items;
}
}); });
} }
$annotations = Ox.AnnotationPanel(Ox.extend({ $annotations = Ox.AnnotationPanel(Ox.extend({
@ -169,7 +174,7 @@ pandora.ui.embedPanel = function() {
layers: video.annotations, layers: video.annotations,
position: options.position, position: options.position,
range: options.annotationsRange, range: options.annotationsRange,
showLayers: options.showLayers, showLayers: ui.showLayers,
showUsers: true, showUsers: true,
sort: options.annotationsSort, sort: options.annotationsSort,
width: window.innerWidth width: window.innerWidth
@ -269,8 +274,11 @@ pandora.ui.embedPanel = function() {
playInToOut: true, playInToOut: true,
showAnnotations: false, showAnnotations: false,
showCloseButton: false, showCloseButton: false,
showLayers: ui.showLayers, showLayers: pandora.site.layers.map(function(layer) {
return layer.id;
}),
showTimeline: false, showTimeline: false,
timeline: ui.videoTimeline,
width: window.innerWidth width: window.innerWidth
}; };
ui.hash.query.forEach(function(condition) { ui.hash.query.forEach(function(condition) {

View file

@ -1057,7 +1057,7 @@ pandora.normalizeHashQuery = function(state) {
'matchRatio', 'matchRatio',
'paused', 'playInToOut', 'paused', 'playInToOut',
'showAnnotations', 'showCloseButton', 'showLayers', 'showTimeline', 'showAnnotations', 'showCloseButton', 'showLayers', 'showTimeline',
'title' 'timeline', 'title'
], ],
isEmbed = state.hash && state.hash.query isEmbed = state.hash && state.hash.query
&& Ox.indexOf(state.hash.query, function(condition) { && Ox.indexOf(state.hash.query, function(condition) {