Wavesurfer voor audio file player

This commit is contained in:
NH Gooi
2024-09-25 17:30:15 +02:00
parent 1dadbc62af
commit 6c732f90e8
7 changed files with 138 additions and 69 deletions

View File

@@ -95,7 +95,7 @@ class RadioController extends Controller
{
$programs = [];
$now = new \DateTimeImmutable('2 minutes ago');
$page = (int)$request->get('pagina', 1);
$page = (int)$request->get('pagina', 1);
$apiResult = $this->API('programma/schema/recent?pagina=' . (int)max(1, $page) . '&aantal=12');
foreach($apiResult->schedule as $item) {
if(!$item->program->nonstop && !$item->program->rerun) {

View File

@@ -14,6 +14,8 @@ class StreamController extends Controller
return view('listen', [
'source' => self::$STREAM_URL . 'mp3live',
'title' => 'Luister live',
'lengte' => 0,
'waveform' => null,
'content' => 'de live-uitzending van NH Gooi.',
'isStream' => true ]);
}
@@ -53,13 +55,20 @@ class StreamController extends Controller
'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'));
$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++) {
@@ -69,10 +78,12 @@ class StreamController extends Controller
}
return view('listen', [
'source' => $this->API_URL . 'programma/stream/' . $current->format('Y/m/d/H') . '/1',
'source' => $this->API_URL . 'programma/stream/' . $current->format('Y/m/d/H'),
'tabs' => $hours,
'title' => 'Uitzending terugluisteren',
'content' => 'de uitzending van ' . $current->format('d-m-Y, H') . ':00 uur',
'lengte' => $programma->waveform->length,
'waveform' => $programma->waveform,
'content' => $programma->programma->name . ' van ' . $current->format('d-m-Y, H') . ':00 uur',
'isStream' => false,
'canDownload' => false ]);
}