streaming-website/pages/room.php

125 lines
2 KiB
PHP
Raw Normal View History

2014-10-01 14:42:22 +00:00
<?php
2014-11-09 19:28:50 +00:00
require_once('lib/bootstrap.php');
2014-10-01 14:42:22 +00:00
2015-02-28 18:12:27 +00:00
2014-10-01 14:42:22 +00:00
$room = $_GET['room'];
$language = $_GET['language'];
2015-02-27 16:21:51 +00:00
$selection = $_GET['selection'];
2014-10-01 14:42:22 +00:00
2015-03-01 15:46:04 +00:00
if(!has("ROOMS.$room"))
return include('404.php');
2015-02-28 18:12:27 +00:00
$formats = get("ROOMS.$room.FORMATS");
2015-02-28 19:50:25 +00:00
$has_translation = get("ROOMS.$room.TRANSLATION");
2015-02-28 18:12:27 +00:00
2015-02-28 19:50:25 +00:00
$protos = array();
2015-02-28 18:12:27 +00:00
$selections = array();
$tabs = array();
2015-02-28 19:50:25 +00:00
$videores = array();
2015-02-28 18:12:27 +00:00
2015-02-28 19:50:25 +00:00
if(room_has_hd($room))
$selections[] = $videores[] = 'hd';
2015-02-28 18:12:27 +00:00
2015-02-28 19:50:25 +00:00
if(room_has_sd($room))
$selections[] = $videores[] = 'sd';
2015-02-28 18:12:27 +00:00
2015-02-28 19:50:25 +00:00
if(room_has_video($room))
2015-02-28 18:12:27 +00:00
$tabs[] = 'video';
2015-02-28 19:50:25 +00:00
if(room_has_audio($room))
2015-02-28 18:12:27 +00:00
$selections[] = $tabs[] = 'audio';
2015-03-01 15:17:20 +00:00
if(room_has_music($room))
$selections[] = $tabs[] = 'music';
2015-02-28 19:50:25 +00:00
if(room_has_slides($room))
2015-02-28 18:12:27 +00:00
$selections[] = $tabs[] = 'slides';
2015-02-28 19:50:25 +00:00
if(room_has_rtmp($room))
$protos[] = 'rtmp';
if(room_has_webm($room))
$protos[] = 'webm';
if(room_has_hls($room))
$protos[] = 'hls';
2015-03-01 15:17:20 +00:00
2015-02-28 18:12:27 +00:00
// default page
if(!$selection)
$selection = $selections[0];
2015-02-28 19:50:25 +00:00
if(!in_array($selection, $selections))
return include('404.php');
2015-02-28 18:12:27 +00:00
2015-02-27 16:21:51 +00:00
switch($selection) {
2014-10-01 14:42:22 +00:00
case 'audio':
2015-02-28 18:12:27 +00:00
$tab = 'audio';
2015-02-27 16:21:51 +00:00
$title = 'Audio';
break;
case 'music':
2015-03-01 15:17:20 +00:00
$tab = 'music';
2015-02-27 16:21:51 +00:00
$title = 'Music';
2014-10-01 14:42:22 +00:00
break;
case 'slides':
2015-02-28 18:12:27 +00:00
$tab = 'slides';
2015-02-27 16:21:51 +00:00
$title = 'Slides';
2015-02-28 19:50:25 +00:00
$width = 1024;
$height = 576;
2014-10-01 14:42:22 +00:00
break;
2014-10-02 14:19:15 +00:00
case 'hd':
2015-02-28 18:12:27 +00:00
$tab = 'video';
2015-02-27 16:21:51 +00:00
$title = 'FullHD Video';
2014-10-01 14:42:22 +00:00
$width = 1920;
$height = 1080;
break;
case 'sd':
2015-02-28 18:12:27 +00:00
$tab = 'video';
2015-02-27 16:21:51 +00:00
$title = 'SD Video';
2014-10-01 14:42:22 +00:00
$width = 1024;
$height = 576;
break;
}
2015-02-28 18:12:27 +00:00
if($language == 'translated')
2015-02-28 19:50:25 +00:00
{
if(!$has_translation)
return include('404.php');
2015-02-28 18:12:27 +00:00
$title = 'Translated '.$title;
2015-02-28 19:50:25 +00:00
}
2015-02-27 16:21:51 +00:00
echo $tpl->render(array(
'page' => 'room',
'title' => get("ROOMS.$room.DISPLAY").' '.$title,
2014-10-01 14:42:22 +00:00
'room' => $room,
2014-11-03 20:53:30 +00:00
'program' => program(),
2015-02-28 18:12:27 +00:00
'tab' => $tab,
'tabs' => $tabs,
2015-02-27 16:21:51 +00:00
2014-10-01 14:42:22 +00:00
'width' => @$width,
'height' => @$height,
'language' => $language,
2014-10-19 11:44:34 +00:00
'translated' => ($language == 'translated'),
2015-02-27 16:21:51 +00:00
'selection' => $selection,
'hlsformat' => ($selection == 'hd' ? 'auto' : $selection),
2015-02-28 19:50:25 +00:00
'has_translation' => $has_translation,
2015-02-28 18:12:27 +00:00
'formats' => $formats,
2015-02-28 19:50:25 +00:00
'protos' => $protos,
'videores' => $videores,
2014-10-01 14:42:22 +00:00
));