Skip to content
Snippets Groups Projects
Commit 6c3554c4 authored by Richard Zameitat's avatar Richard Zameitat :cat2:
Browse files

manifest improvements + media details

parent 309b3592
Branches
Tags
No related merge requests found
/node_modules/
/web-ext-artifacts/
......@@ -10,15 +10,12 @@ if (window.location.host === 'engage.streaming.rwth-aachen.de') {
window._meta = meta
let videoTracks = meta['search-results'].result.mediapackage.media.track
.filter(t=> t.mimetype.startsWith('video/') && t.url.startsWith('http'))
.sort((a,b) => {
let mimeComp = a.mimetype.localeCompare(b.mimetype)
if (mimeComp) return mimeComp
let resAI = parseInt(a.video.resolution)
let resBI = parseInt(b.video.resolution)
if (resAI > resBI) return 1
if (resAI < resBI) return -1
return 0
})
.sort((a,b) =>
a.mimetype.localeCompare(b.mimetype)
|| Math.sign(parseInt(a.video.resolution) - parseInt(b.video.resolution))
|| Math.sign(a.video.bitrate - b.video.bitrate)
|| 00
)
videoTracks.forEach(t=>console.debug(t.id, t.mimetype, t.video.resolution, t.url))
if (inFrame) {
window.parent.postMessage({videoTracks, meta}, '*')
......@@ -66,6 +63,19 @@ function genVideoContainerId(vidIdOrMeta) {
return `${genIdPrefix(vidIdOrMeta)}_container`
}
const FMT = (()=>{
const _locale = undefined
const _defaults = { style: 'unit', unitDisplay: 'narrow'}
const kbps = new Intl.NumberFormat(undefined, {..._defaults, unit: 'kilobit-per-second'})
const base = new Intl.NumberFormat(undefined, {..._defaults, style: 'decimal' })
return {
fps: v => `${base.format(v)}fps`,
hz: v => `${base.format(v/1000)}kHz`,
bps: v => kbps.format(v/1000),
}
})()
function genLinkContainer(tracks, meta) {
let videoTitle = meta['search-results'].result.dcTitle || '?'
let details = document.createElement('details')
......@@ -78,11 +88,17 @@ function genLinkContainer(tracks, meta) {
let videoLinkList = document.createElement('ul')
videoLinkList.classList.add('videoLinkList')
tracks.forEach(track => {
let mVid = track.video || {}
let mAud = track.audio || {}
let li = document.createElement('li')
let a = document.createElement('a')
a.classList.add('videoLink')
a.href = track.url
a.innerText = `${track.video.resolution} (${track.mimetype.replace(/^video\//, '')})`
a.innerText = `${mVid.resolution} (${track.mimetype.replace(/^video\//, '')})`
a.title = `Title: ${videoTitle}
Type: ${track.mimetype}
Video: ${mVid.resolution}@${FMT.fps(mVid.framerate)} (${FMT.bps(mVid.bitrate)}, ${mVid.encoder.type})
Audio: ${mAud.channels}ch@${FMT.hz(mAud.samplingrate)} (${FMT.bps(mAud.bitrate)}, ${mAud.encoder.type})`
li.appendChild(a)
videoLinkList.appendChild(li)
})
......
{
"manifest_version": 2,
"name": "OpenExcellenceMedia",
"version": "0.0.1",
"version": "0.0.2",
"description": "Adds download links to videos on RWTH moodle which are served using an OpenCast iframe.",
"homepage_url": "https://git.fsmpi.rwth-aachen.de/moodleOpenCastDownloads/ff-ext",
"icons": {
"48": "icons/base-00.export-plain-opti.svg",
"96": "icons/base-00.export-plain-opti.svg",
......@@ -18,6 +19,13 @@
"js": ["free.js"],
"css": ["free.css"]
}
]
],
"browser_specific_settings": {
"gecko": {
"id": "{cc975a31-cc03-49ce-8c82-2b265f327227}",
"strict_min_version": "60.0",
"update_url": "https://dev.sudo42.de/public/ff-addons/updates.json"
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment