Skip to content

Commit

Permalink
Add index number to predefined assets to make using the `autoLoadSour…
Browse files Browse the repository at this point in the history
…ce` URL parameter easier
  • Loading branch information
dweinber committed Jul 2, 2024
1 parent a613c54 commit 9df86d3
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions web/js/pageSetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ function setupTestPage() {
yospacePlayer.unload();
deselectCustomLoadButton();
});
createSourceList('vod', 'predefined-sources');
createSourceList('linear', 'predefined-sources');
var startIndex = 1;
var nextIndex = createSourceList('vod', 'predefined-sources', startIndex);
createSourceList('linear', 'predefined-sources', nextIndex);

setupTable();

Expand Down Expand Up @@ -92,7 +93,7 @@ function modifySourceBeforeLoading(source) {
return updateWithPlatformSpecificSourceConfig(source);
}

function createSourceList(streamType, containerId) {
function createSourceList(streamType, containerId, index) {
var sourceList = document.querySelector('#' + containerId);
Object.keys(sources[streamType]).forEach(function (source) {
var input = document.createElement('input');
Expand All @@ -104,16 +105,21 @@ function createSourceList(streamType, containerId) {
var label = document.createElement('label');
label.classList.add('btn');
label.classList.add('btn-outline-secondary');
label.innerText = streamType.toUpperCase() + ': ' + (sources[streamType][source].title ? sources[streamType][source].title : source);
label.innerText =
index + ': ' + streamType.toUpperCase() + ': ' + (sources[streamType][source].title ? sources[streamType][source].title : source);
index++;
label.onclick = function (event) {
yospacePlayer.load(modifySourceBeforeLoading(sources[streamType][source]));
var sourceId = source.substring(source.indexOf(': '));
yospacePlayer.load(modifySourceBeforeLoading(sources[streamType][sourceId]));
deselectCustomLoadButton();
};

label.appendChild(input);

sourceList.appendChild(label);
});

return index;
}

function log(message) {
Expand Down

0 comments on commit 9df86d3

Please sign in to comment.