109 lines
4.2 KiB
PHP
Executable File
109 lines
4.2 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use \Illuminate\Http\Request;
|
|
use \Model\Podcast;
|
|
|
|
class StreamController extends Controller
|
|
{
|
|
private static $STREAM_URL = 'https://stream.nhgooi.nl:8001/';
|
|
|
|
public function liveradio()
|
|
{
|
|
return view('listen', [
|
|
'source' => self::$STREAM_URL . 'mp3live',
|
|
'title' => 'Luister live',
|
|
'lengte' => 0,
|
|
'waveform' => null,
|
|
'content' => 'de live-uitzending van NH Gooi.',
|
|
'isStream' => true ]);
|
|
}
|
|
|
|
public function livetv()
|
|
{
|
|
return view('watch', ['title' => 'Kijk NH Gooi Tv', 'stream' => 'https://rrr.sz.xlcdn.com/?account=nhnieuws&file=nhgooi&type=live&service=wowza&protocol=https&output=playlist.m3u8']);
|
|
// return view('watch', ['stream' => 'https://stream.nhgooi.nl:81/tv']);
|
|
}
|
|
|
|
public function studio()
|
|
{
|
|
// return view('watch', ['stream' => 'https://stream.nhgooi.nl:81/live/studio']);
|
|
return view('watch', ['title' => 'Kijk NH Gooi Tv Studio', 'stream' => 'https://studiocam.nhgooi.nl/studiocam/live/index.m3u8']);
|
|
}
|
|
|
|
public function inline(Request $request, $id)
|
|
{
|
|
$apiResult = $this->API('podcast/details/' . (int)$id);
|
|
$podcast = new \Model\Podcast($apiResult);
|
|
if(sha1($id . ':' . date('Y-m-d')) != $request->get('auth')) {
|
|
// return view('widgets/podcastplayer', ['podcast' => null]);
|
|
}
|
|
|
|
return view('widgets/podcastplayer', ['podcast' => $podcast]);
|
|
}
|
|
|
|
public function podcast(Request $request, $id)
|
|
{
|
|
$apiResult = $this->API('podcast/details/' . (int)$id);
|
|
$podcast = new \Model\Podcast($apiResult);
|
|
if($podcast->auth != $request->get('auth')) {
|
|
return view('podcastredirect', ['podcast' => $podcast]);
|
|
}
|
|
|
|
return view('listen', [
|
|
'source' => $this->API_URL . 'podcast/stream/' . $apiResult->url,
|
|
'title' => $podcast->title,
|
|
'content' => $podcast->title,
|
|
'lengte' => $podcast->duration / 1000,
|
|
'waveform' => $podcast->waveform,
|
|
'isStream' => false,
|
|
'canDownload' => $this->API_URL . 'podcast/download/' . $apiResult->url ]);
|
|
}
|
|
|
|
public function program(Request $request, $year, $month, $day, $hour, $duration, $offset = 0) {
|
|
$date = (new \DateTimeImmutable())->setDate($year, $month, $day)->setTime($hour, 0, 0);
|
|
$current = $date->add(\DateInterval::createFromDateString($offset . ' hours'));
|
|
|
|
$programma = $this->API("programma/details/" . $current->Format("Y/m/d/H"));
|
|
if(!$programma->is_beschikbaar) {
|
|
return view('listen', ['notAvailable' => true]);
|
|
}
|
|
|
|
$hours = [];
|
|
for($i = 0; $i < $duration; $i++) {
|
|
$other = $date->add(\DateInterval::createFromDateString($i . ' hours'));
|
|
$url = '/luister/programma/' . $date->format('Y/m/d/H') . '/' . $duration . '/' . $i;
|
|
$hours[$offset == $i ? '#' : $url] = 'Uur ' . ($i + 1) . ' (' . $other->format('H') . ':00)';
|
|
}
|
|
|
|
return view('listen', [
|
|
'source' => $this->API_URL . 'programma/stream/' . $current->format('Y/m/d/H'),
|
|
'tabs' => $hours,
|
|
'title' => 'Uitzending terugluisteren',
|
|
'lengte' => $programma->waveform->length,
|
|
'waveform' => $programma->waveform,
|
|
'content' => $programma->programma->name . ' van ' . $current->format('d-m-Y, H') . ':00 uur',
|
|
'isStream' => false,
|
|
'canDownload' => false ]);
|
|
}
|
|
|
|
public function gemeenteraad(Request $request) {
|
|
return view('listen', [
|
|
'source' => self::$STREAM_URL . 'gemhuizen',
|
|
'title' => 'Gemeenteraad Huizen',
|
|
'content' => 'de openbare vergadering van de gemeenteraad Huizen',
|
|
'isStream' => true,
|
|
'canDownload' => false ]);
|
|
}
|
|
|
|
public function kerkdienst(Request $request) {
|
|
return view('listen', [
|
|
'source' => $this->API_URL . 'kerkdienst/stream',
|
|
'title' => 'Kerkdienst gemist',
|
|
'content' => 'de kerkdienst van afgelopen zondag',
|
|
'isStream' => false,
|
|
'canDownload' => $this->API_URL . 'kerkdienst/download' ]);
|
|
}
|
|
}
|