Add HLS to playlist; auto-redirect players visiting public pages.
This commit is contained in:
parent
3068f7c4e7
commit
8c7a4d7854
|
@ -20,8 +20,13 @@ release channel, you can take advantage of these new features and fixes.
|
|||
- Because both our Docker and Ansible installations are managed by Supervisor now, we can view the realtime status of
|
||||
all essential application services, and even restart them directly from the web interface.
|
||||
|
||||
- If you enter the link for a public player page into a media player app (i.e. VLC), it will automatically redirect to
|
||||
the playlist file and play appropriately.
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- HLS streams will now be included in Playlist (PLS/M3U) file downloads.
|
||||
|
||||
- Fixed an issue where listener connection times over a day didn't properly show up.
|
||||
|
||||
- Fixed several issues contributing to slow load times on media manager pages.
|
||||
|
|
|
@ -76,13 +76,24 @@ final class PlayerAction
|
|||
);
|
||||
}
|
||||
|
||||
// Render full page player.
|
||||
$props['stationName'] = $station->getName();
|
||||
$props['enableRequests'] = $station->getEnableRequests();
|
||||
$props['downloadPlaylistUri'] = $router->named(
|
||||
'public:playlist',
|
||||
['station_id' => $station->getShortName(), 'format' => 'pls']
|
||||
);
|
||||
|
||||
// Auto-redirect requests from players to the playlist (PLS) download.
|
||||
$userAgent = strtolower($request->getHeaderLine('User-Agent'));
|
||||
$players = ['mpv', 'player', 'vlc', 'applecoremedia'];
|
||||
foreach ($players as $player) {
|
||||
if (str_contains($userAgent, $player)) {
|
||||
return $response->withRedirect($props['downloadPlaylistUri']);
|
||||
}
|
||||
}
|
||||
|
||||
// Render full page player.
|
||||
$props['stationName'] = $station->getName();
|
||||
$props['enableRequests'] = $station->getEnableRequests();
|
||||
|
||||
$props['requestListUri'] = $router->named(
|
||||
'api:requests:list',
|
||||
['station_id' => $station->getId()]
|
||||
|
|
|
@ -61,6 +61,27 @@ final class PlaylistAction
|
|||
];
|
||||
}
|
||||
|
||||
if ($station->getEnableHls() && $station->getBackendTypeEnum()->isEnabled()) {
|
||||
$backend = $this->adapters->getBackendAdapter($station);
|
||||
$backendConfig = $station->getBackendConfig();
|
||||
|
||||
if (null !== $backend && $backendConfig->getHlsEnableOnPublicPlayer()) {
|
||||
$streamUrl = $backend->getHlsUrl($station);
|
||||
$streamRow = [
|
||||
'name' => $station->getName() . ' - HLS',
|
||||
'url' => (string)$streamUrl,
|
||||
];
|
||||
|
||||
if ($backendConfig->getHlsIsDefault()) {
|
||||
array_unshift($stream_urls, $streamUrl);
|
||||
array_unshift($streams, $streamRow);
|
||||
} else {
|
||||
$stream_urls[] = $streamUrl;
|
||||
$streams[] = $streamRow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$format = strtolower($format);
|
||||
switch ($format) {
|
||||
// M3U Playlist Format
|
||||
|
|
Loading…
Reference in New Issue