From 4d1d96c8f7bd1376ccd0eebe17c9520fa6c3dcc4 Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Wed, 21 Oct 2015 16:14:06 -0400 Subject: [PATCH] CC-6140: M3U streaming link --- .../application/controllers/ApiController.php | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index ca0d182ef..7541f7daf 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -24,7 +24,8 @@ class ApiController extends Zend_Controller_Action "show-tracks", "show-schedules", "station-logo", - "show-logo" + "show-logo", + "stream-m3u" ); if (Zend_Session::isStarted()) { @@ -1501,5 +1502,23 @@ class ApiController extends Zend_Controller_Action $hint = Application_Common_UsabilityHints::getUsabilityHint($userPath); $this->_helper->json->sendJson($hint); } - + + public function streamM3uAction() + { + $this->view->layout()->disableLayout(); + $this->_helper->viewRenderer->setNoRender(true); + + header('Content-Type: application/x-mpegurl'); + header('Content-Disposition: attachment; filename=stream.m3u'); + $m3uFile = "#EXTM3U\n\n"; + + $stationName = Application_Model_Preference::GetStationName(); + $streamData = Application_Model_StreamSetting::getEnabledStreamData(); + + foreach ($streamData as $stream) { + $m3uFile .= "#EXTINF,".$stationName." - " . strtoupper($stream['codec']) . "\n"; + $m3uFile .= $stream['url'] . "\n\n"; + } + echo $m3uFile; + } }