oxjs/demos/videoeditor/js/videoeditor.js

138 lines
4.1 KiB
JavaScript
Raw Normal View History

2011-05-18 16:00:29 +00:00
Ox.load('UI', {
debug: true,
theme: 'modern'
}, function() {
2011-05-19 10:18:39 +00:00
//var id = '0393109';
var id = '0097514';
2011-05-18 16:00:29 +00:00
2011-05-19 10:18:39 +00:00
Ox.get('srt/' + id + '.srt', function(srt) {
var subtitles = Ox.parseSRT(srt/*, 25*/),
2011-05-19 10:18:39 +00:00
layers = [
2011-05-19 12:37:19 +00:00
{
editable: true,
id: 'privatenotes',
items: [],
title: 'Private Notes'
},
{
editable: true,
id: 'publicnotes',
items: [],
title: 'Public Notes'
},
2011-05-19 10:18:39 +00:00
{
id: 'subtitles',
items: subtitles.map(function(subtitle, i) {
return {id: i, 'in': subtitle.in, out: subtitle.out, value: subtitle.text};
}),
title: 'Subtitles'
}
];
var $appPanel, $mainPanel;
2011-05-18 16:00:29 +00:00
var $videoEditor = Ox.VideoEditor({
annotationsSize: 256,
2011-05-19 10:18:39 +00:00
duration: 3029.96,
2011-05-18 16:00:29 +00:00
find: 'dode',
2011-05-18 18:30:58 +00:00
getFrameURL: function(position, width) {
2011-05-19 10:18:39 +00:00
return 'http://next.0xdb.org/' + id + '/frame/' + width + '/' + position + '.jpg'
2011-05-18 18:30:58 +00:00
},
2011-05-18 16:00:29 +00:00
getLargeTimelineImageURL: function(i) {
2011-05-19 10:18:39 +00:00
return 'http://next.0xdb.org/' + id + '/timelines/timeline.64.' + i + '.png';
2011-05-18 16:00:29 +00:00
},
getSmallTimelineImageURL: function(i) {
2011-05-19 10:18:39 +00:00
return 'http://next.0xdb.org/' + id + '/timelines/timeline.16.' + i + '.png';
2011-05-18 16:00:29 +00:00
},
height: window.innerHeight - 129,
2011-05-19 10:18:39 +00:00
'in': 0,
layers: layers,
out: 0,
position: 0,
posterFrame: 1515,
showAnnotations: true,
2011-05-18 16:00:29 +00:00
subtitles: subtitles,
video: {
2011-05-19 10:18:39 +00:00
96: 'http://next.0xdb.org/' + id + '/96p.webm',
240: 'http://next.0xdb.org/' + id + '/96p.webm?240p',
480: 'http://next.0xdb.org/' + id + '/96p.webm?480p'
2011-05-18 16:00:29 +00:00
},
videoHeight: 96,
videoSize: 'small',
2011-05-19 10:18:39 +00:00
videoWidth: 124,
2011-05-18 16:00:29 +00:00
width: window.innerWidth - 257
});
$appPanel = Ox.SplitPanel({
2011-05-18 16:00:29 +00:00
elements: [
{
collapsible: true,
element: Ox.Element(),
resizable: true,
resize: [128, 256, 384],
size: 256
},
{
element: $mainPanel = Ox.SplitPanel({
2011-05-18 16:00:29 +00:00
elements: [
{
collapsible: true,
element: Ox.Element(),
resizable: true,
resize: [64, 128, 192],
size: 128
},
{
element: $videoEditor
}
],
orientation: 'vertical'
})
}
],
orientation: 'horizontal'
})
.appendTo(Ox.UI.$body);
Ox.UI.$window.bind({
resize: function() {
$videoEditor.options({
2011-05-19 12:37:19 +00:00
width: $appPanel.getSize(1),
height: $mainPanel.getSize(1)
});
}
});
$mainPanel.bindEvent({
2011-05-18 16:00:29 +00:00
resize: function(foo, size) {
$videoEditor.options({
width: size
});
}
});
$videoEditor.bindEvent({
resize: function(foo, size) {
Ox.print('RESIZING', size)
$videoEditor.options({
height: size
});
}
});
$videoEditor.$element.bindEvent({
resize: function(foo, size) {
Ox.print('RESIZING', size)
2011-05-18 16:00:29 +00:00
$videoEditor.options({
height: size
});
}
});
2011-05-18 16:00:29 +00:00
});
});