update player view

This commit is contained in:
rlx 2011-08-17 19:34:55 +00:00
parent e5ffcf23f3
commit 1da1579d9e
3 changed files with 54 additions and 31 deletions

View file

@ -541,8 +541,10 @@
"sitePage": "home", "sitePage": "home",
"theme": "modern", "theme": "modern",
"videoPosition": {}, "videoPosition": {},
"videoScreen": "fit", "videoScale": "fit",
"videoSize": "small" "videoMuted": false,
"videoSize": "small",
"videoVolume": 1
}, },
"username": "" "username": ""
}, },

View file

@ -219,39 +219,62 @@ pandora.ui.item = function() {
pandora.$ui.map.resizeMap(); pandora.$ui.map.resizeMap();
})); }));
} else if (pandora.user.ui.itemView == 'player') { } else if (pandora.user.ui.itemView == 'player') {
var video = result.data.stream, // fixme: duplicated
format = $.support.video.supportedFormat(video.formats); var layers = [],
video.height = video.resolutions[0]; video = result.data.stream,
cuts = result.data.cuts || [],
format = $.support.video.supportedFormat(video.formats),
streams = {};
video.height = video.resolutions[0];
video.width = parseInt(video.height * video.aspectRatio / 2) * 2; video.width = parseInt(video.height * video.aspectRatio / 2) * 2;
video.url = video.baseUrl + '/' + video.height + 'p.' + format; video.resolutions.forEach(function(profile) {
streams[profile] = video.baseUrl + '/' + profile + 'p.' + format;
});
$.each(pandora.site.layers, function(i, layer) {
layers[i] = $.extend({}, layer, {items: result.data.layers[layer.id]});
});
//
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.player = Ox.VideoPanelPlayer({ pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.player = Ox.VideoPanelPlayer({
annotationsSize: pandora.user.ui.annotationsSize, annotationsSize: pandora.user.ui.annotationsSize,
duration: video.duration, duration: video.duration,
getTimelineImageURL: function(i) {
return '/' + pandora.user.ui.item + '/timeline64p' + i + '.png';
},
height: pandora.$ui.contentPanel.size(1), height: pandora.$ui.contentPanel.size(1),
muted: pandora.user.ui.videoMuted,
position: pandora.user.ui.videoPosition[pandora.user.ui.item] || 0, position: pandora.user.ui.videoPosition[pandora.user.ui.item] || 0,
scaleToFill: pandora.user.ui.videoScale == 'fill',
showAnnotations: pandora.user.ui.showAnnotations, showAnnotations: pandora.user.ui.showAnnotations,
showControls: pandora.user.ui.showControls, showControls: pandora.user.ui.showControls,
subtitles: result.data.layers.subtitles, subtitles: result.data.layers.subtitles.map(function(subtitle) {
return {'in': subtitle['in'], out: subtitle.out, text: subtitle.value};
}),
timeline: '/' + pandora.user.ui.item + '/timeline16p.png',
video: streams,
videoHeight: video.height, videoHeight: video.height,
videoId: pandora.user.ui.item, //videoId: pandora.user.ui.item,
videoWidth: video.width, videoWidth: video.width,
videoSize: pandora.user.ui.videoScreen, volume: pandora.user.ui.videoVolume,
videoURL: video.url,
width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1 width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1
}).bindEvent({ }).bindEvent({
change: function(event, data) { muted: function(data) {
// showAnnotations, showControls, videoScreen pandora.UI.set('muted', data.muted);
pandora.UI.set('videoSize' in data ? { },
videoScreen: data.videoSize resizeannotations: function(data) {
} : data); pandora.UI.set('annotationsSize', data.annotationsSize);
},
scale: function(data) {
pandora.UI.set('videoScale', data.scale);
},
toggleannotations: function(data) {
pandora.UI.set('showAnnotations', data.showAnnotations);
},
togglecontrols: function(data) {
pandora.UI.set('showControls', data.showControls);
},
volume: function(data) {
pandora.UI.set('volume', data.volume);
}, },
enterfullscreen: pandora.enterFullscreen,
exitfullscreen: pandora.exitFullscreen,
resize: function(event, data) {
pandora.$ui.player.options({
height: data
});
}
})); }));
} else if (pandora.user.ui.itemView == 'statistics') { } else if (pandora.user.ui.itemView == 'statistics') {
var stats = Ox.Container(); var stats = Ox.Container();
@ -303,11 +326,11 @@ pandora.ui.item = function() {
subtitles: result.data.layers.subtitles.map(function(subtitle) { subtitles: result.data.layers.subtitles.map(function(subtitle) {
return {'in': subtitle['in'], out: subtitle.out, text: subtitle.value}; return {'in': subtitle['in'], out: subtitle.out, text: subtitle.value};
}), }),
video: streams,
videoHeight: video.height, videoHeight: video.height,
videoId: pandora.user.ui.item, //videoId: pandora.user.ui.item,
videoWidth: video.width, videoWidth: video.width,
videoSize: pandora.user.ui.videoSize, videoSize: pandora.user.ui.videoSize,
video: streams,
width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1 width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1
}).bindEvent({ }).bindEvent({
resize: function(data) { resize: function(data) {
@ -321,7 +344,7 @@ pandora.ui.item = function() {
togglesize: function(data) { togglesize: function(data) {
pandora.UI.set({videoSize: data.size}); pandora.UI.set({videoSize: data.size});
}, },
addAnnotation: function(data) { addannotation: function(data) {
Ox.print('addAnnotation', data); Ox.print('addAnnotation', data);
data.item = pandora.user.ui.item; data.item = pandora.user.ui.item;
data.value = 'Click to edit'; data.value = 'Click to edit';
@ -329,16 +352,16 @@ pandora.ui.item = function() {
pandora.$ui.editor.addAnnotation(data.layer, result.data); pandora.$ui.editor.addAnnotation(data.layer, result.data);
}); });
}, },
removeAnnotations: function(data) { removeannotations: function(data) {
pandora.api.removeAnnotations(data, function(result) { pandora.api.removeAnnotations(data, function(result) {
//fixme: check for errors //fixme: check for errors
pandora.$ui.editor.removeAnnotations(data.layer, data.ids); pandora.$ui.editor.removeAnnotations(data.layer, data.ids);
}); });
}, },
toggleAnnotations: function(data) { toggleannotations: function(data) {
pandora.UI.set('showAnnotations', data.visible); pandora.UI.set('showAnnotations', data.showAnnotations);
}, },
updateAnnotation: function(data) { updateannotation: function(data) {
//fixme: check that edit was successfull //fixme: check that edit was successfull
pandora.api.editAnnotation(data, function(result) { pandora.api.editAnnotation(data, function(result) {
Ox.print('done updateAnnotation', result); Ox.print('done updateAnnotation', result);

View file

@ -50,8 +50,6 @@ pandora.ui.rightPanel = function() {
pandora.user.ui.itemView == 'timeline' && pandora.$ui.editor.options({ pandora.user.ui.itemView == 'timeline' && pandora.$ui.editor.options({
width: data width: data
}); });
pandora.user.ui.itemView == 'frames' && pandora.$ui.item.resize();
pandora.user.ui.itemView == 'posters' && pandora.$ui.item.resize();
} }
} }
}); });