aboutsummaryrefslogtreecommitdiff
path: root/pages/room.php
blob: ba4e35b9b5689af5d3fd70e49675a855f9d1d71d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php

require_once('lib/bootstrap.php');


$room = $_GET['room'];
$language = $_GET['language'];
$selection = $_GET['selection'];

$formats = get("ROOMS.$room.FORMATS");

$selections = array();
$tabs = array();


if(count(array_intersect(array('rtmp-hd', 'hls-hd', 'webm-hd'), $formats)) > 0)
	$selections[] = 'hd';

if(count(array_intersect(array('rtmp-sd', 'hls-sd', 'webm-sd'), $formats)) > 0)
	$selections[] = 'sd';

if(count(array_intersect(array('rtmp-sd', 'rtmp-hd', 'hls-sd', 'hls-hd', 'webm-sd', 'webm-hd'), $formats)) > 0)
	$tabs[] = 'video';

if(count(array_intersect(array('audio-mp3', 'audio-opus'), $formats)) > 0)
	$selections[] = $tabs[] = 'audio';

if(count(array_intersect(array('slides'), $formats)) > 0)
	$selections[] = $tabs[] = 'slides';


// default page
if(!$selection)
	$selection = $selections[0];

if(!in_array($selection, $selections)) {
	include('404.php');
	exit;
}


switch($selection) {
	case 'audio':
		$tab = 'audio';
		$title = 'Audio';
		break;

	case 'music':
		$tab = 'audio';
		$title = 'Music';
		break;

	case 'slides':
		$tab = 'slides';
		$title = 'Slides';
		break;

	case 'hd':
		$tab = 'video';
		$title = 'FullHD Video';
		$width = 1920;
		$height = 1080;
		break;

	case 'sd':
		$tab = 'video';
		$title = 'SD Video';
		$width = 1024;
		$height = 576;
		break;
}

if($language == 'translated')
	$title = 'Translated '.$title;

echo $tpl->render(array(
	'page' => 'room',

	'title' => get("ROOMS.$room.DISPLAY").' – '.$title,
	'room' => $room,

	'program' => program(),

	'tab' => $tab,
	'tabs' => $tabs,

	'width' => @$width,
	'height' => @$height,
	'language' => $language,
	'translated' => ($language == 'translated'),
	'selection' => $selection,
	'hlsformat' => ($selection == 'hd' ? 'auto' : $selection),
	'formats' => $formats,
));