From e745c1dda97684677b57106b1c941997cd497be2 Mon Sep 17 00:00:00 2001 From: "Christopher C. Wells" Date: Tue, 22 Sep 2020 13:07:43 -0700 Subject: [PATCH] Add method to get a Video HLS stream file --- src/LiveStream/LiveStream.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/LiveStream/LiveStream.php b/src/LiveStream/LiveStream.php index cf31b8b..4e4b2cb 100644 --- a/src/LiveStream/LiveStream.php +++ b/src/LiveStream/LiveStream.php @@ -427,6 +427,23 @@ public function getLiveVideo( return $video; } + /** + * Gets contents of a Video's HLS stream (m3u8) file. + * + * Requires a secure access token. + * + * @param \LiveStream\Resources\Video $video + * + * @return string|null + * @throws \LiveStream\Exceptions\LiveStreamException + */ + public function getVideoHlsFile(Video $video): ?string { + if (!$video->m3u8) return null; + + $endpoint = substr($video->m3u8, strlen(self::BASE_URL)); + return $this->request($endpoint); + } + /** * Refreshes a secure access token if invalid (5 minute life time). *