Skip to content

Commit

Permalink
Allow live stream for rooms without schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzschmid committed Feb 15, 2021
1 parent b2c4e2e commit 282d354
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
jekyll-theme-conference (3.1.1)
jekyll-theme-conference (3.1.2)
jekyll (~> 4.0)

GEM
Expand Down
51 changes: 41 additions & 10 deletions _includes/js/conference-live.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,12 +363,21 @@ window.conference.live = (function() {
}
};

let getTalks = function (roomName) {
if (roomName in data.talks) {
return data.talks[roomName];
}
else {
return false;
}
};

let getNextTalk = function (roomName) {
// Get talk object for next talk in given room
let timeNow = time();
let talksHere = data.talks[roomName];
let talksHere = getTalks(roomName);

if (typeof talksHere !== "undefined") {
if (talksHere) {
if (timeNow < talksHere[talksHere.length-1].end) {
for (var i = 0; i < talksHere.length; i++) {
if (timeNow < talksHere[i].end) {
Expand All @@ -383,9 +392,9 @@ window.conference.live = (function() {
let getNextPause = function (roomName) {
// Get time object for next pause in given room
let timeNow = time();
let talksHere = data.talks[roomName];
let talksHere = getTalks(roomName);

if (typeof talksHere !== "undefined") {
if (talksHere) {
if (timeNow < talksHere[talksHere.length-1].end) {
for (var i = 1; i < talksHere.length; i++) {
if (timeNow < talksHere[i].start && streamPause*60 <= talksHere[i].start - talksHere[i-1].end) {
Expand Down Expand Up @@ -420,9 +429,29 @@ window.conference.live = (function() {
// Show stream with start/pause/end message (for given room) and keep updated
let timeNow = time();

let talksHere = data.talks[roomName];
let roomStart = talksHere[0].start;
let roomEnd = talksHere[talksHere.length-1].end;
let talksHere = getTalks(roomName);
let roomStart, roomEnd;
if (talksHere) {
roomStart = talksHere[0].start;
roomEnd = talksHere[talksHere.length-1].end;
}
else {
// If no program for given room, take overall first and last talk
roomStart = 0;
roomEnd = 0;
for (let roomNameTalk in data.talks) {
talksHere = getTalks(roomNameTalk);
let crntRoomStart = talksHere[0].start;
let crntRoomEnd = talksHere[talksHere.length-1].end;

if (roomStart == 0 || roomStart > crntRoomStart) {
roomStart = crntRoomStart;
}
if (roomEnd == 0 || roomEnd < crntRoomEnd) {
roomEnd = crntRoomEnd;
}
}
}

if (typeof streamVideoTimer !== "undefined") {
clearInterval(streamVideoTimer);
Expand Down Expand Up @@ -485,7 +514,7 @@ window.conference.live = (function() {
clearInterval(streamInfoTimer);
}

if (timeNow >= talkNext.start - streamPause*60) {
if (talkNext && timeNow >= talkNext.start - streamPause*60) {
document.getElementById('stream-info').dataset.time = talkNext.start;
document.getElementById('stream-info-time').dataset.time = talkNext.start;
updateLive();
Expand Down Expand Up @@ -524,8 +553,10 @@ window.conference.live = (function() {
streamInfoTimer = setTimeout(setStreamInfo, delayStart(talkNext.start - streamPause*60) * 1000, roomName);
}
else if (demo) {
let talksHere = data.talks[roomName];
streamInfoTimer = setTimeout(setStreamInfo, delayStart(talksHere[0].start - streamPrepend*60) * 1000, roomName);
let talksHere = getTalks(roomName);
if (talksHere) {
streamInfoTimer = setTimeout(setStreamInfo, delayStart(talksHere[0].start - streamPrepend*60) * 1000, roomName);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion jekyll-theme-conference.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |spec|
spec.name = "jekyll-theme-conference"
spec.version = "3.1.1"
spec.version = "3.1.2"
spec.authors = ["Lorenz Schmid"]
spec.email = ["lorenzschmid@users.noreply.github.com"]

Expand Down

0 comments on commit 282d354

Please sign in to comment.