2016-12-20 22:14:35 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
|
2018-05-12 00:06:16 +00:00
|
|
|
$basetime = time();
|
2017-01-01 13:44:39 +00:00
|
|
|
$struct = [];
|
2016-12-20 22:14:35 +00:00
|
|
|
foreach (Conferences::getActiveConferences() as $conference)
|
|
|
|
{
|
2018-05-12 00:06:16 +00:00
|
|
|
$now = $conference->getSchedule()->getScheduleDisplayTime($basetime);
|
2016-12-20 22:14:35 +00:00
|
|
|
$overview = $conference->getOverview();
|
|
|
|
|
2018-12-19 21:50:32 +00:00
|
|
|
$isCurrentlyStreaming = false;
|
2018-05-12 11:54:00 +00:00
|
|
|
|
2019-10-24 07:57:01 +00:00
|
|
|
// iterate through all rooms and only activate flag if there is something other than a daychange event
|
2018-05-12 11:54:00 +00:00
|
|
|
foreach($conference->getRooms() as $room) {
|
|
|
|
$currentTalk = $room->getCurrentTalk($now);
|
|
|
|
|
2018-12-19 21:50:32 +00:00
|
|
|
if ($currentTalk) {
|
2019-10-24 07:57:01 +00:00
|
|
|
// if current event is a daychange ignore room, but only if the next talk does not start in 30 minutes
|
|
|
|
if ( !(isset($currentTalk['special']) && $currentTalk['special'] == 'daychange' && $currentTalk['end'] - $basetime > 30*60 )) {
|
2018-12-19 21:50:32 +00:00
|
|
|
$isCurrentlyStreaming = true;
|
|
|
|
break;
|
|
|
|
}
|
2018-05-12 11:54:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-20 22:14:35 +00:00
|
|
|
$groupstruct = array();
|
|
|
|
foreach($overview->getGroups() as $group => $rooms)
|
|
|
|
{
|
|
|
|
$roomstruct = array();
|
|
|
|
foreach($rooms as $room)
|
|
|
|
{
|
|
|
|
$streams = array();
|
|
|
|
foreach($room->getStreams() as $stream)
|
|
|
|
{
|
|
|
|
$key = $stream->getSelection().'-'.$stream->getLanguage();
|
|
|
|
|
|
|
|
$urls = array();
|
|
|
|
switch($stream->getPlayerType())
|
|
|
|
{
|
|
|
|
case 'video':
|
|
|
|
foreach ($stream->getVideoProtos() as $proto => $display)
|
|
|
|
{
|
|
|
|
$urls[$proto] = array(
|
|
|
|
'display' => $display,
|
|
|
|
'tech' => $stream->getVideoTech($proto),
|
|
|
|
'url' => $stream->getVideoUrl($proto),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'slides':
|
|
|
|
foreach ($stream->getSlidesProtos() as $proto => $display)
|
|
|
|
{
|
|
|
|
$urls[$proto] = array(
|
|
|
|
'display' => $display,
|
|
|
|
'tech' => $stream->getSlidesTech($proto),
|
|
|
|
'url' => $stream->getSlidesUrl($proto),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'audio':
|
|
|
|
foreach ($stream->getAudioProtos() as $proto => $display)
|
|
|
|
{
|
|
|
|
$urls[$proto] = array(
|
|
|
|
'display' => $display,
|
|
|
|
'tech' => $stream->getAudioTech($proto),
|
|
|
|
'url' => $stream->getAudioUrl($proto),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'music':
|
|
|
|
foreach ($stream->getMusicProtos() as $proto => $display)
|
|
|
|
{
|
|
|
|
$urls[$proto] = array(
|
|
|
|
'display' => $display,
|
|
|
|
'tech' => $stream->getMusicTech($proto),
|
|
|
|
'url' => $stream->getMusicUrl($proto),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
break;
|
2021-12-26 01:21:10 +00:00
|
|
|
|
2016-12-29 11:03:32 +00:00
|
|
|
case 'dash':
|
2021-12-26 01:21:10 +00:00
|
|
|
if(!$room->h264Only()):
|
|
|
|
$urls['dash'] = array(
|
|
|
|
'display' => 'DASH, baby',
|
|
|
|
'tech' => $room->getDashTech(),
|
|
|
|
'url' => $room->getDashManifestUrl(),
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
endif;
|
2016-12-20 22:14:35 +00:00
|
|
|
}
|
|
|
|
|
2021-12-26 01:38:18 +00:00
|
|
|
if($room->h264Only() and $key == "dash-native") {
|
|
|
|
continue;
|
|
|
|
} else {
|
2021-12-26 01:21:10 +00:00
|
|
|
$streams[] = array(
|
|
|
|
'slug' => $key,
|
|
|
|
'display' => $stream->getDisplay(),
|
|
|
|
'type' => $stream->getPlayerType(),
|
|
|
|
'isTranslated' => $stream->isTranslated(),
|
|
|
|
'videoSize' => $stream->getVideoSize(),
|
|
|
|
'urls' => (object)$urls,
|
|
|
|
);
|
2021-12-26 01:38:18 +00:00
|
|
|
}
|
2016-12-20 22:14:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$roomstruct[] = array(
|
2023-12-20 14:35:07 +00:00
|
|
|
'guid' => $room->getId(),
|
2016-12-20 22:14:35 +00:00
|
|
|
'slug' => $room->getSlug(),
|
2023-12-20 14:35:07 +00:00
|
|
|
'schedulename' => $room->getScheduleName(), // deprecated, use guid instead
|
2020-04-11 13:40:08 +00:00
|
|
|
'thumb' => $room->getThumb(),
|
2020-09-04 17:55:18 +00:00
|
|
|
'poster' => $room->getPoster(),
|
2016-12-20 22:14:35 +00:00
|
|
|
'link' => forceslash(baseurl()).$room->getLink(),
|
|
|
|
'display' => $room->getDisplay(),
|
2017-11-25 23:19:28 +00:00
|
|
|
'stream' => $room->getStream(),
|
2018-05-12 00:06:16 +00:00
|
|
|
'talks' => [
|
|
|
|
'current' => $room->getCurrentTalk($now),
|
|
|
|
'next' => $room->getNextTalk($now),
|
|
|
|
],
|
2016-12-20 22:14:35 +00:00
|
|
|
'streams' => $streams,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
$groupstruct[] = array(
|
|
|
|
'group' => $group,
|
|
|
|
'rooms' => $roomstruct,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
$struct[] = array(
|
|
|
|
'conference' => $conference->getTitle(),
|
|
|
|
'slug' => $conference->getSlug(),
|
|
|
|
'author' => $conference->getAuthor(),
|
|
|
|
'description' => $conference->getDescription(),
|
|
|
|
'keywords' => $conference->getKeywords(),
|
2017-11-25 23:19:28 +00:00
|
|
|
'schedule' => $conference->getSchedule()->getScheduleUrl(),
|
2016-12-20 22:14:35 +00:00
|
|
|
'startsAt' => $conference->startsAt() ? $conference->startsAt()->format(DateTime::ISO8601) : null,
|
|
|
|
'endsAt' => $conference->endsAt() ? $conference->endsAt()->format(DateTime::ISO8601) : null,
|
2018-12-19 21:50:32 +00:00
|
|
|
'isCurrentlyStreaming' => $isCurrentlyStreaming,
|
2016-12-20 22:14:35 +00:00
|
|
|
'groups' => $groupstruct,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2016-12-29 11:01:56 +00:00
|
|
|
echo json_encode($struct, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
|