Skip to content

Commit e8f27fe

Browse files
bug fixes #78
1 parent 46cf59b commit e8f27fe

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/HLSPlaylist.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,13 @@ private function getAudioBitrate(Representation $rep): int
107107
private function getOriginalAudioBitrate(): int
108108
{
109109
try {
110-
return $this->hls
111-
->getMedia()
112-
->getStreams()
113-
->audios()
114-
->first()
115-
->get('bit_rate', static::DEFAULT_AUDIO_BITRATE);
110+
$audios = $this->hls->getMedia()->getStreams()->audios();
111+
112+
if (!$audios->count()){
113+
return static::DEFAULT_AUDIO_BITRATE;
114+
}
115+
116+
return $audios->first()->get('bit_rate', static::DEFAULT_AUDIO_BITRATE);
116117
} catch (ExceptionInterface $e) {
117118
return static::DEFAULT_AUDIO_BITRATE;
118119
}

0 commit comments

Comments
 (0)