force protocol on urls coming from relive

This commit is contained in:
MaZderMind 2015-12-28 11:21:51 +01:00
parent c16e317e20
commit d1fdb62377
3 changed files with 11 additions and 3 deletions

View file

@ -37,6 +37,14 @@ function forceslash($url)
return $url;
}
function forceproto($url)
{
if(startswith('//', $url))
$url = proto().':'.$url;
return $url;
}
function startswith($needle, $haystack)
{
return substr($haystack, 0, strlen($needle)) == $needle;

View file

@ -8,7 +8,7 @@
class="relive"
>
<source
src="<?=h($talk['playlist'])?>"
src="<?=h(forceproto($talk['playlist']))?>"
title="h.264 (HLS)"
type="application/x-mpegURL"
/>

View file

@ -21,7 +21,7 @@
<div class="col-xs-12">
<div class="alert alert-success">
<h3>Download</h3>
<p>Click here to <a href="<?=h($talk['mp4'])?>">Download</a> this Relive recording. Beware! This is an unprocessed streamdump a final release will follow soon.</p>
<p>Click here to <a href="<?=h(forceproto($talk['mp4']))?>">Download</a> this Relive recording. Beware! This is an unprocessed streamdump a final release will follow soon.</p>
</div>
</div>
</div>
@ -42,7 +42,7 @@
<h3>Sorry about the Flash</h3>
<p>
As there is no desktop player which supports time-shifting, we chose embed a Flash player here which does.
If you still want to watch with a desktop player, use this URL: <a href="<?=h($talk['playlist'])?>"><?=h($talk['playlist'])?></a>
If you still want to watch with a desktop player, use this URL: <a href="<?=h(forceproto($talk['playlist']))?>"><?=h(forceproto($talk['playlist']))?></a>
</p>
<p>
Note: Downloading this file is useless because of the way HLS works. You need to play the URL from your player.