mirror of
https://github.com/AzuraCast/AzuraCast.git
synced 2024-06-14 21:26:37 +00:00
Fixes #6712 -- Add "hls_is_default" to NP station API endpoint and use it on player frontend.
This commit is contained in:
parent
f85d91aade
commit
c8bcee0ad8
|
@ -178,16 +178,20 @@ const currentStream = shallowRef<CurrentStreamDescriptor>({
|
|||
hls: false,
|
||||
});
|
||||
|
||||
const enable_hls = computed(() => {
|
||||
const enableHls = computed(() => {
|
||||
return props.showHls && np.value?.station?.hls_enabled;
|
||||
});
|
||||
|
||||
const hlsIsDefault = computed(() => {
|
||||
return enableHls.value && np.value?.station?.hls_is_default;
|
||||
});
|
||||
|
||||
const {$gettext} = useTranslate();
|
||||
|
||||
const streams = computed<CurrentStreamDescriptor[]>(() => {
|
||||
const allStreams = [];
|
||||
|
||||
if (enable_hls.value) {
|
||||
if (enableHls.value) {
|
||||
allStreams.push({
|
||||
name: $gettext('HLS'),
|
||||
url: np.value?.station?.hls_url,
|
||||
|
@ -260,7 +264,7 @@ const onNowPlayingUpdated = (np_new) => {
|
|||
let $currentStream = currentStream.value;
|
||||
|
||||
if ($currentStream.url === '' && $streams.length > 0) {
|
||||
if (props.hlsIsDefault && enable_hls.value) {
|
||||
if (hlsIsDefault.value) {
|
||||
currentStream.value = $streams[0];
|
||||
} else {
|
||||
$currentStream = null;
|
||||
|
|
|
@ -6,10 +6,6 @@ export default {
|
|||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
hlsIsDefault: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
showAlbumArt: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
|
|
|
@ -101,6 +101,12 @@ final class Station implements ResolvableUrlInterface
|
|||
)]
|
||||
public bool $hls_enabled = false;
|
||||
|
||||
#[OA\Property(
|
||||
description: 'If the HLS stream should be the default one for the station.',
|
||||
example: true
|
||||
)]
|
||||
public bool $hls_is_default = false;
|
||||
|
||||
#[OA\Property(
|
||||
description: 'The full URL to listen to the HLS stream for the station.',
|
||||
example: 'https://example.com/hls/azuratest_radio/live.m3u8',
|
||||
|
|
|
@ -76,6 +76,8 @@ final class StationApiGenerator
|
|||
$response->remotes = $remotes;
|
||||
|
||||
$response->hls_enabled = $station->getBackendType()->isEnabled() && $station->getEnableHls();
|
||||
$response->hls_is_default = $response->hls_enabled && $station->getBackendConfig()->getHlsIsDefault();
|
||||
|
||||
$response->hls_url = (null !== $backend && $response->hls_enabled)
|
||||
? $backend->getHlsUrl($station, $baseUri)
|
||||
: null;
|
||||
|
|
Loading…
Reference in New Issue
Block a user