diff options
author | MaZderMind | 2015-04-05 19:05:33 +0200 |
---|---|---|
committer | MaZderMind | 2015-04-05 19:05:33 +0200 |
commit | c28560754e2e4f7bb79f32c97edbe36dbaed6d54 (patch) | |
tree | 30d999029ad2cad0bfd430f7501aba756d42a168 /view/streams-json-v1.php | |
parent | 02fb25f64021afde4f48699b54168b6816d8cb1e (diff) |
Streams-JSON v1
Diffstat (limited to 'view/streams-json-v1.php')
-rw-r--r-- | view/streams-json-v1.php | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/view/streams-json-v1.php b/view/streams-json-v1.php new file mode 100644 index 0000000..0988269 --- /dev/null +++ b/view/streams-json-v1.php @@ -0,0 +1,87 @@ +<?php + +header('Content-Type: application/json'); + +if($conference->isClosed()) +{ + echo '{}'; + return; +} + +$overview = new Overview(); + +$struct = array(); +foreach($overview->getGroups() as $group => $rooms) +{ + 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; + } + + $streams[$key] = array( + 'display' => $stream->getDisplay(), + 'type' => $stream->getPlayerType(), + 'isTranslated' => $stream->isTranslated(), + 'videoSize' => $stream->getVideoSize(), + 'urls' => $urls, + ); + } + + $struct[$group][$room->getSlug()] = array( + 'display' => $room->getDisplay(), + 'streams' => $streams, + ); + } +} + +echo json_encode($struct, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); |