mirror of
https://github.com/voc/streaming-website
synced 2024-11-10 06:34:17 +00:00
music & audio tabs
This commit is contained in:
parent
20dd29c322
commit
b07e1beaa8
7 changed files with 102 additions and 53 deletions
|
@ -33,11 +33,11 @@ function link_stream($protocol, $room, $format, $translated = false)
|
|||
case 'webm':
|
||||
return 'http://cdn.c3voc.de/'.rawurlencode(streamname($room)).'_'.rawurlencode($language).'_'.rawurlencode($format).'.webm';
|
||||
|
||||
case 'music':
|
||||
return 'http://cdn.c3voc.de/'.rawurlencode(streamname($room)).'.'.rawurlencode($format);
|
||||
|
||||
case 'audio':
|
||||
if(in_array($room, array('lounge', 'ambient')))
|
||||
return 'http://cdn.c3voc.de/'.rawurlencode(streamname($room)).'.'.rawurlencode($format);
|
||||
else
|
||||
return 'http://cdn.c3voc.de/'.rawurlencode(streamname($room)).'_'.rawurlencode($language).'.'.rawurlencode($format);
|
||||
return 'http://cdn.c3voc.de/'.rawurlencode(streamname($room)).'_'.rawurlencode($language).'.'.rawurlencode($format);
|
||||
|
||||
case 'slide':
|
||||
return 'http://cdn.c3voc.de/slides/'.rawurlencode(streamname($room)).'/current.png';
|
||||
|
@ -157,7 +157,13 @@ function room_has_video($room)
|
|||
function room_has_audio($room)
|
||||
{
|
||||
$formats = get("ROOMS.$room.FORMATS");
|
||||
return count(array_intersect(array('audio-mp3', 'audio-opus'), $formats)) > 0;
|
||||
return count(array_intersect(array('audio-mp3', 'audio-opus', 'audio-ogg'), $formats)) > 0;
|
||||
}
|
||||
|
||||
function room_has_music($room)
|
||||
{
|
||||
$formats = get("ROOMS.$room.FORMATS");
|
||||
return count(array_intersect(array('music-mp3', 'music-opus', 'music-ogg'), $formats)) > 0;
|
||||
}
|
||||
|
||||
function room_has_slides($room)
|
||||
|
|
|
@ -28,6 +28,9 @@ if(room_has_video($room))
|
|||
if(room_has_audio($room))
|
||||
$selections[] = $tabs[] = 'audio';
|
||||
|
||||
if(room_has_music($room))
|
||||
$selections[] = $tabs[] = 'music';
|
||||
|
||||
if(room_has_slides($room))
|
||||
$selections[] = $tabs[] = 'slides';
|
||||
|
||||
|
@ -42,6 +45,7 @@ if(room_has_hls($room))
|
|||
$protos[] = 'hls';
|
||||
|
||||
|
||||
|
||||
// default page
|
||||
if(!$selection)
|
||||
$selection = $selections[0];
|
||||
|
@ -58,7 +62,7 @@ switch($selection) {
|
|||
break;
|
||||
|
||||
case 'music':
|
||||
$tab = 'audio';
|
||||
$tab = 'music';
|
||||
$title = 'Music';
|
||||
break;
|
||||
|
||||
|
|
|
@ -3,12 +3,22 @@
|
|||
preload="auto"
|
||||
style="width: 230px;"
|
||||
>
|
||||
<source
|
||||
src="<?=h(link_stream('audio', $room, 'mp3', @$translated))?>"
|
||||
type="audio/mp3"
|
||||
/>
|
||||
<source
|
||||
src="<?=h(link_stream('audio', $room, 'opus', @$translated))?>"
|
||||
type="audio/opus"
|
||||
/>
|
||||
<? if(in_array("audio-mp3", $formats)): ?>
|
||||
<source
|
||||
src="<?=h(link_stream('audio', $room, 'mp3', @$translated))?>"
|
||||
type="audio/mp3"
|
||||
/>
|
||||
<? endif ?>
|
||||
<? if(in_array("audio-opus", $formats)): ?>
|
||||
<source
|
||||
src="<?=h(link_stream('audio', $room, 'opus', @$translated))?>"
|
||||
type="audio/opus"
|
||||
/>
|
||||
<? endif ?>
|
||||
<? if(in_array("audio-ogg", $formats)): ?>
|
||||
<source
|
||||
src="<?=h(link_stream('audio', $room, 'ogg', @$translated))?>"
|
||||
type="audio/ogg"
|
||||
/>
|
||||
<? endif ?>
|
||||
</audio>
|
||||
|
|
24
template/assemblies/player/music.phtml
Normal file
24
template/assemblies/player/music.phtml
Normal file
|
@ -0,0 +1,24 @@
|
|||
<audio
|
||||
autoplay="autoplay"
|
||||
preload="auto"
|
||||
style="width: 230px;"
|
||||
>
|
||||
<? if(in_array("music-mp3", $formats)): ?>
|
||||
<source
|
||||
src="<?=h(link_stream('music', $room, 'mp3', @$translated))?>"
|
||||
type="audio/mp3"
|
||||
/>
|
||||
<? endif ?>
|
||||
<? if(in_array("music-opus", $formats)): ?>
|
||||
<source
|
||||
src="<?=h(link_stream('music', $room, 'opus', @$translated))?>"
|
||||
type="audio/opus"
|
||||
/>
|
||||
<? endif ?>
|
||||
<? if(in_array("music-ogg", $formats)): ?>
|
||||
<source
|
||||
src="<?=h(link_stream('music', $room, 'ogg', @$translated))?>"
|
||||
type="audio/ogg"
|
||||
/>
|
||||
<? endif ?>
|
||||
</audio>
|
|
@ -1,12 +1,11 @@
|
|||
<div class="container-fluid">
|
||||
<h3>Audio</h3>
|
||||
<div class="formats row">
|
||||
<? if($has_translation): ?>
|
||||
<h3>Audio</h3>
|
||||
<div class="formats row">
|
||||
|
||||
<div class="col-lg-3 col-md-4 col-lg-5 col-xs-12">
|
||||
<div class="btn-group" role="group">
|
||||
<div class="btn btn-primary" disabled>Audio</div>
|
||||
|
||||
<? if($has_translation): ?>
|
||||
<div class="col-lg-3 col-md-4 col-lg-5 col-xs-12">
|
||||
<div class="btn-group" role="group">
|
||||
<div class="btn btn-primary" disabled>Audio</div>
|
||||
|
||||
<a href="<?=h(link_player($room, 'audio'))?>" class="btn btn-default">
|
||||
<span class="fa fa-flag-o"></span>
|
||||
|
@ -17,24 +16,17 @@
|
|||
translated
|
||||
</a>
|
||||
|
||||
<? else: ?>
|
||||
|
||||
<a href="<?=h(link_player($room, 'audio'))?>" class="btn btn-default">
|
||||
<span class="fa fa-video-camera"></span>
|
||||
video
|
||||
</a>
|
||||
|
||||
<? endif ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<? endif ?>
|
||||
|
||||
|
||||
<h3>Directlinks</h3>
|
||||
<div class="formats row">
|
||||
|
||||
<? foreach(array_intersect($formats, array('audio-mp3', 'audio-opus')) as $format): ?>
|
||||
<? foreach(array_intersect($formats, array('audio-mp3', 'audio-opus', 'audio-ogg')) as $format): ?>
|
||||
<div class="col-lg-3 col-md-4 col-lg-5 col-xs-12">
|
||||
<? $proto = substr($format, 6) ?>
|
||||
<div class="btn-group" role="group">
|
||||
|
@ -54,8 +46,8 @@
|
|||
<? else: ?>
|
||||
|
||||
<a href="<?=h(link_stream('audio', $room, $proto))?>" class="btn btn-default">
|
||||
<span class="fa fa-video-camera"></span>
|
||||
video
|
||||
<span class="fa fa-volume-up"></span>
|
||||
audio
|
||||
</a>
|
||||
|
||||
<? endif ?>
|
||||
|
|
21
template/assemblies/switcher/music.phtml
Normal file
21
template/assemblies/switcher/music.phtml
Normal file
|
@ -0,0 +1,21 @@
|
|||
<div class="container-fluid">
|
||||
<h3>Directlinks</h3>
|
||||
<div class="formats row">
|
||||
|
||||
<? foreach(array_intersect($formats, array('music-mp3', 'music-opus', 'music-ogg')) as $format): ?>
|
||||
<div class="col-lg-3 col-md-4 col-lg-5 col-xs-12">
|
||||
<? $proto = substr($format, 6) ?>
|
||||
<div class="btn-group" role="group">
|
||||
<div class="btn btn-primary" disabled><?=h(strtoupper($proto))?></div>
|
||||
|
||||
<a href="<?=h(link_stream('music', $room, $proto))?>" class="btn btn-default">
|
||||
<span class="fa fa-music"></span>
|
||||
music
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<? endforeach ?>
|
||||
|
||||
</div>
|
||||
</div>
|
|
@ -1,12 +1,11 @@
|
|||
<div class="container-fluid">
|
||||
<h3>Slides</h3>
|
||||
<div class="formats row">
|
||||
<? if($has_translation): ?>
|
||||
<h3>Slides</h3>
|
||||
<div class="formats row">
|
||||
|
||||
<div class="col-lg-3 col-md-4 col-lg-5 col-xs-12">
|
||||
<div class="btn-group" role="group">
|
||||
<div class="btn btn-primary" disabled>Slides</div>
|
||||
|
||||
<? if($has_translation): ?>
|
||||
<div class="col-lg-3 col-md-4 col-lg-5 col-xs-12">
|
||||
<div class="btn-group" role="group">
|
||||
<div class="btn btn-primary" disabled>Slides</div>
|
||||
|
||||
<a href="<?=h(link_player($room, 'slides'))?>" class="btn btn-default">
|
||||
<span class="fa fa-flag-o"></span>
|
||||
|
@ -17,18 +16,11 @@
|
|||
translated
|
||||
</a>
|
||||
|
||||
<? else: ?>
|
||||
|
||||
<a href="<?=h(link_player($room, 'slides'))?>" class="btn btn-default">
|
||||
<span class="fa fa-video-camera"></span>
|
||||
native
|
||||
</a>
|
||||
|
||||
<? endif ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<? endif ?>
|
||||
|
||||
<h3>Directlinks</h3>
|
||||
<div class="formats row">
|
||||
|
@ -52,8 +44,8 @@
|
|||
<? else: ?>
|
||||
|
||||
<a href="<?=h(link_stream($proto, $room, 'slides'))?>" class="btn btn-default">
|
||||
<span class="fa fa-video-camera"></span>
|
||||
video
|
||||
<span class="fa fa-picture-o"></span>
|
||||
slides
|
||||
</a>
|
||||
|
||||
<? endif ?>
|
||||
|
|
Loading…
Reference in a new issue