use position from url as poster
This commit is contained in:
parent
9526133f9b
commit
85c4917fa7
1 changed files with 17 additions and 2 deletions
|
@ -90,6 +90,18 @@ async function sortClips(edit, sort) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getClip(edit, position) {
|
||||||
|
const response = {}
|
||||||
|
let pos = 0
|
||||||
|
edit.clips.forEach(function(clip) {
|
||||||
|
if (clip.position < position && clip.position + clip.duration > position) {
|
||||||
|
response.item = clip.id
|
||||||
|
response.position = position - clip.position
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return response
|
||||||
|
}
|
||||||
|
|
||||||
async function loadEdit(id, args) {
|
async function loadEdit(id, args) {
|
||||||
var data = window.data = {}
|
var data = window.data = {}
|
||||||
data.id = id
|
data.id = id
|
||||||
|
@ -235,8 +247,11 @@ async function loadEdit(id, args) {
|
||||||
data.title = data.edit.name
|
data.title = data.edit.name
|
||||||
data.byline = data.edit.description
|
data.byline = data.edit.description
|
||||||
data.link = `${pandora.proto}://${data.site}/edits/${data.edit.id}`
|
data.link = `${pandora.proto}://${data.site}/edits/${data.edit.id}`
|
||||||
const poster = data.edit.posterFrames[0]
|
let poster = data.edit.posterFrames[0]
|
||||||
if (poster) {
|
if (args.parts[2] && args.parts[2].indexOf(':') > -1) {
|
||||||
|
poster = getClip(data.edit, parseDuration(args.parts[2]))
|
||||||
|
}
|
||||||
|
if (poster && poster.item) {
|
||||||
data.poster = `${pandora.proto}://${data.site}/${poster.item}/480p${poster.position}.jpg`
|
data.poster = `${pandora.proto}://${data.site}/${poster.item}/480p${poster.position}.jpg`
|
||||||
} else {
|
} else {
|
||||||
data.poster = data.videos[0].src.split('/48')[0] + `/480p${data.videos[0].in}.jpg`
|
data.poster = data.videos[0].src.split('/48')[0] + `/480p${data.videos[0].in}.jpg`
|
||||||
|
|
Loading…
Reference in a new issue