presentation.sources is now expected to be an object instead of a list

This commit is contained in:
Erik Thuning 2022-11-30 11:16:38 +01:00
parent 353b4af391
commit d5cb2021cf

@ -32,7 +32,8 @@ function init() {
var mainstream = document.querySelector('.main > video')
// A bit too magic with all the [0] but what can you do...
var defaultres = Object.keys(presentation.sources[0].video)[0]
var defaultres = Object.keys(
Object.values(presentation.sources)[0].video)[0]
if('resolution' in cookies) {
defaultres = cookies.resolution
@ -77,7 +78,7 @@ function init() {
setupFullscreen()
setupCopying(mainstream)
setupVolume(mainstream, cookies.volume, cookies.mute)
setupResSwitching(presentation.sources, defaultres)
setupResSwitching(Object.values(presentation.sources), defaultres)
setupSwitching(mainstream)
setupSync(mainstream)
setupPlayback(body, mainstream)
@ -198,13 +199,13 @@ function swapText(element) {
}
function loadStreams(presentation, mainstream, defaultres) {
var streamlist = presentation.sources
var streamlist = Object.values(presentation.sources)
var token = presentation.token
var mainparent = mainstream.parentNode
var template = document.getElementById('stream-template')
var main = streamlist[0]
if(typeof main.video === "string") {
mainstream.src = main.video +"?token="+ token
} else {