open part in player

This commit is contained in:
j 2017-06-06 10:45:35 +02:00
parent 462a9d8ef6
commit 307852c0c6

View file

@ -326,6 +326,7 @@ pandora.ui.mediaView = function(options) {
updateStatus(); updateStatus();
}, },
select: selectFiles, select: selectFiles,
open: openVideo,
submit: function(data) { submit: function(data) {
var value = self.$filesList.value(data.id, data.key); var value = self.$filesList.value(data.id, data.key);
if (data.value != value && !(data.value === '' && value === null)) { if (data.value != value && !(data.value === '' && value === null)) {
@ -571,6 +572,7 @@ pandora.ui.mediaView = function(options) {
}); });
} }
function openFiles(data) { function openFiles(data) {
data.ids.length == 1 && pandora.api.parsePath({ data.ids.length == 1 && pandora.api.parsePath({
path: self.$instancesList.value(data.ids[0], 'path') path: self.$instancesList.value(data.ids[0], 'path')
@ -590,6 +592,25 @@ pandora.ui.mediaView = function(options) {
}); });
} }
function openVideo(data) {
if (data.ids.length == 1) {
// fixme only selected videos!
var stream = data.ids[0];
pandora.api.get({id: pandora.user.ui.item, keys: ['streams', 'durations']}, function(result) {
var offset = result.data.streams.indexOf(stream),
set = {
itemView: pandora.user.ui.videoView
},
videoPoints = {};
Ox.print(offset, result.data.streams);
videoPoints['position'] = videoPoints['in'] = Ox.sum(result.data.durations.slice(0, offset));
videoPoints['out'] = videoPoints['in'] + result.data.durations[offset];
set['videoPoints.' + pandora.user.ui.item] = videoPoints;
pandora.UI.set(set);
});
}
}
function selectFiles(data) { function selectFiles(data) {
self.selected = data.ids; self.selected = data.ids;
self.$instancesList.options({ self.$instancesList.options({