refactor embed js
This commit is contained in:
parent
7dbbc8291a
commit
a773f68dc7
1 changed files with 21 additions and 20 deletions
|
@ -8,7 +8,7 @@ Ox.load('UI', {
|
||||||
showScreen: true,
|
showScreen: true,
|
||||||
theme: 'oxdark'
|
theme: 'oxdark'
|
||||||
}, function() {
|
}, function() {
|
||||||
var videoKeys = [ 'duration', 'layers', 'parts', 'posterFrame', 'rightslevel', 'size', 'title', 'videoRatio' ];
|
var videoKeys = ['duration', 'layers', 'parts', 'posterFrame', 'rightslevel', 'size', 'title', 'videoRatio'];
|
||||||
window.pandora = new Ox.App({url: '/api/'}).bindEvent({
|
window.pandora = new Ox.App({url: '/api/'}).bindEvent({
|
||||||
load: function(data) {
|
load: function(data) {
|
||||||
Ox.extend(pandora, {
|
Ox.extend(pandora, {
|
||||||
|
@ -42,7 +42,7 @@ Ox.load('UI', {
|
||||||
height: window.innerHeight,
|
height: window.innerHeight,
|
||||||
invertHighlight: true,
|
invertHighlight: true,
|
||||||
paused: options.paused,
|
paused: options.paused,
|
||||||
poster: '/' + options.item + '/' + '96p' + options['in'] +'.jpg',
|
poster: '/' + options.item + '/' + '96p' + data.posterFrame +'.jpg',
|
||||||
resolution: pandora.user.ui.videoResolution,
|
resolution: pandora.user.ui.videoResolution,
|
||||||
showMarkers: false,
|
showMarkers: false,
|
||||||
showMilliseconds: 0,
|
showMilliseconds: 0,
|
||||||
|
@ -53,7 +53,8 @@ Ox.load('UI', {
|
||||||
width: window.innerWidth
|
width: window.innerWidth
|
||||||
}, options['in'] ? {
|
}, options['in'] ? {
|
||||||
'in': options['in'],
|
'in': options['in'],
|
||||||
position: options['in']
|
position: options['in'],
|
||||||
|
poster: '/' + options.item + '/' + '96p' + options['in'] +'.jpg',
|
||||||
} : {}, options.out ? {
|
} : {}, options.out ? {
|
||||||
out: options.out
|
out: options.out
|
||||||
} : {}))
|
} : {}))
|
||||||
|
@ -78,7 +79,6 @@ Ox.load('UI', {
|
||||||
} : {}))
|
} : {}))
|
||||||
);
|
);
|
||||||
Ox.UI.hideLoadingScreen();
|
Ox.UI.hideLoadingScreen();
|
||||||
|
|
||||||
});
|
});
|
||||||
return that;
|
return that;
|
||||||
},
|
},
|
||||||
|
@ -160,15 +160,6 @@ Ox.load('UI', {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function getVideoUrl(id, resolution, part) {
|
|
||||||
var prefix = pandora.site.site.videoprefix
|
|
||||||
.replace('{id}', id)
|
|
||||||
.replace('{part}', part)
|
|
||||||
.replace('{resolution}', resolution)
|
|
||||||
.replace('{uid}', Ox.uid());
|
|
||||||
return prefix + '/' + id + '/' + resolution + 'p' + part + '.' + pandora.user.videoFormat;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getVideoOptions(data) {
|
function getVideoOptions(data) {
|
||||||
var canPlayClips = data.editable || pandora.site.capabilities.canPlayClips[pandora.user.level] >= data.rightslevel,
|
var canPlayClips = data.editable || pandora.site.capabilities.canPlayClips[pandora.user.level] >= data.rightslevel,
|
||||||
canPlayVideo = data.editable || pandora.site.capabilities.canPlayVideo[pandora.user.level] >= data.rightslevel,
|
canPlayVideo = data.editable || pandora.site.capabilities.canPlayVideo[pandora.user.level] >= data.rightslevel,
|
||||||
|
@ -200,12 +191,7 @@ Ox.load('UI', {
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
: [{'in': 0, out: data.duration}];
|
: [{'in': 0, out: data.duration}];
|
||||||
options.video = {};
|
options.duration = data.duration;
|
||||||
pandora.site.video.resolutions.forEach(function(resolution) {
|
|
||||||
options.video[resolution] = Ox.range(data.parts).map(function(i) {
|
|
||||||
return getVideoUrl(data.item || pandora.user.ui.item, resolution, i + 1);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
options.layers = [];
|
options.layers = [];
|
||||||
pandora.site.layers.forEach(function(layer, i) {
|
pandora.site.layers.forEach(function(layer, i) {
|
||||||
options.layers[i] = Ox.extend({}, layer, {
|
options.layers[i] = Ox.extend({}, layer, {
|
||||||
|
@ -218,11 +204,26 @@ Ox.load('UI', {
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
options.duration = data.duration;
|
options.posterFrame = data.posterFrame;
|
||||||
|
options.video = {};
|
||||||
|
pandora.site.video.resolutions.forEach(function(resolution) {
|
||||||
|
options.video[resolution] = Ox.range(data.parts).map(function(i) {
|
||||||
|
return getVideoUrl(data.item || pandora.user.ui.item, resolution, i + 1);
|
||||||
|
});
|
||||||
|
});
|
||||||
options.videoRatio = data.videoRatio;
|
options.videoRatio = data.videoRatio;
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getVideoUrl(id, resolution, part) {
|
||||||
|
var prefix = pandora.site.site.videoprefix
|
||||||
|
.replace('{id}', id)
|
||||||
|
.replace('{part}', part)
|
||||||
|
.replace('{resolution}', resolution)
|
||||||
|
.replace('{uid}', Ox.uid());
|
||||||
|
return prefix + '/' + id + '/' + resolution + 'p' + part + '.' + pandora.user.videoFormat;
|
||||||
|
}
|
||||||
|
|
||||||
function parseQuery() {
|
function parseQuery() {
|
||||||
var vars = window.location.search.length
|
var vars = window.location.search.length
|
||||||
? window.location.search.slice(1).split('&')
|
? window.location.search.slice(1).split('&')
|
||||||
|
|
Loading…
Reference in a new issue