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 | |
parent | 02fb25f64021afde4f48699b54168b6816d8cb1e (diff) |
Streams-JSON v1
Diffstat (limited to '')
-rw-r--r-- | index.php | 5 | ||||
-rw-r--r-- | model/Stream.php | 66 | ||||
-rw-r--r-- | view/streams-json-v1.php | 87 |
3 files changed, 154 insertions, 4 deletions
@@ -49,6 +49,11 @@ try { require('view/schedule-json.php'); } + else if($route == 'streams/v1.json') + { + require('view/streams-json-v1.php'); + } + else if($conference->isClosed()) { require('view/closed.php'); diff --git a/model/Stream.php b/model/Stream.php index 402dfff..0d96a02 100644 --- a/model/Stream.php +++ b/model/Stream.php @@ -108,10 +108,30 @@ class Stream case 'hls': return 'http://cdn.c3voc.de/hls/'.rawurlencode($this->getRoom()->getStream()).'_'.rawurlencode($this->getLanguage()).'_'.rawurlencode($this->getSelection()).'.m3u8'; + } - default: - return null; + return null; + } + public function getVideoTech($proto) + { + switch($proto) + { + case 'webm': + if($this->getSelection() == 'hd') + return '1920x1080, VP8+Vorbis in WebM, 2.8 MBit/s'; + + else if($this->getSelection() == 'sd') + return '1024x576, VP8+Vorbis in WebM, 800 kBit/s'; + + case 'hls': + if($this->getSelection() == 'hd') + return '1920x1080, h264+AAC im MPEG-TS-Container via HTTP, 3 MBit/s'; + + else if($this->getSelection() == 'sd') + return '1024x576, h264+AAC im MPEG-TS-Container via HTTP, 800 kBit/s'; } + + return null; } public static function getVideoProtos() { @@ -125,6 +145,19 @@ class Stream { return $this->getVideoUrl($proto); } + public function getSlidesTech($proto) + { + switch($proto) + { + case 'webm': + return '1024x576, VP8+Vorbis in WebM, XXX kBit/s'; + + case 'hls': + return '1024x576, h264+AAC im MPEG-TS-Container via HTTP, XXX kBit/s'; + } + + return null; + } public static function getSlidesProtos() { return Stream::getVideoProtos(); @@ -140,10 +173,22 @@ class Stream case 'opus': return 'http://cdn.c3voc.de/'.rawurlencode($this->getRoom()->getStream()).'_'.rawurlencode($this->getLanguage()).'.opus'; + } - default: - return null; + return null; + } + public function getAudioTech($proto) + { + switch($proto) + { + case 'mp3': + return 'MP3-Audio, 96 kBit/s'; + + case 'opus': + return 'Opus-Audio, 64 kBit/s'; } + + return null; } public static function getAudioProtos() { @@ -167,6 +212,19 @@ class Stream return null; } } + public function getMusicTech($proto) + { + switch($proto) + { + case 'mp3': + return 'MP3-Audio, 192 kBit/s'; + + case 'opus': + return 'Opus-Audio, 96 kBit/s'; + } + + return null; + } public static function getMusicProtos() { return array( 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); |