From 09efacf4d5f136e136db19148abc8188836ae317 Mon Sep 17 00:00:00 2001 From: drigato Date: Tue, 27 Oct 2015 16:00:15 -0400 Subject: [PATCH] SAAS-1156: Podcast episode playback and download from Radio Page Playback works in HTML mode for mp3 files only right now. Added a function that changes the player iframe's src attribute so it plays individual tracks. --- .../application/controllers/EmbedController.php | 4 ++++ .../application/views/scripts/embed/player.phtml | 4 ++++ .../application/views/scripts/index/index.phtml | 11 ++++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/controllers/EmbedController.php b/airtime_mvc/application/controllers/EmbedController.php index 8ba168dc3..51daf9301 100644 --- a/airtime_mvc/application/controllers/EmbedController.php +++ b/airtime_mvc/application/controllers/EmbedController.php @@ -54,6 +54,10 @@ class EmbedController extends Zend_Controller_Action array_push($availableDesktopStreams, $s); } } + } else if ($stream == "file") { + $this->view->playerMode = "file"; + $this->view->streamURL = json_encode($request->getParam("file_url")); + $this->view->codec = $request->getParam("file_codec"); } elseif (!empty($stream)) { $this->view->playerMode = "manual"; $selectedStreamData = $streamData[$stream]; diff --git a/airtime_mvc/application/views/scripts/embed/player.phtml b/airtime_mvc/application/views/scripts/embed/player.phtml index b85cb15a2..760eb5751 100644 --- a/airtime_mvc/application/views/scripts/embed/player.phtml +++ b/airtime_mvc/application/views/scripts/embed/player.phtml @@ -40,6 +40,9 @@ if (this.playerMode == "manual") { this.settings.url = streamURL ?>; this.settings.codec = "codec ?>"; + } else if (this.playerMode == "file") { + this.settings.url = streamURL ?>; + this.settings.codec = "codec ?>"; } else if (this.playerMode == "auto") { this.availableMobileStreamQueue = availableMobileStreams?>; this.availableDesktopStreamQueue = availableDesktopStreams?>; @@ -213,6 +216,7 @@ if (musesPlayer.playerMode == "auto") { var stream = musesPlayer.getNextAvailableStream(); musesPlayer.deferredPlay(stream["url"], RETRY_DELAY_MSECS); + } else if (musesPlayer.playerMode == "file") { } else { // If in manual mode and there is a problem connecting to // the stream display an error and stop play back. diff --git a/airtime_mvc/application/views/scripts/index/index.phtml b/airtime_mvc/application/views/scripts/index/index.phtml index b5bba59ce..69db9b65a 100644 --- a/airtime_mvc/application/views/scripts/index/index.phtml +++ b/airtime_mvc/application/views/scripts/index/index.phtml @@ -57,7 +57,16 @@ document.getElementById(id).width= (newwidth) + "px"; $.each(episodes ?>, function(index, value){ $("#tab-4").append("
"+value.track_metadata.artist_name+" - "+value.track_metadata.track_title+ " Download" + - " Play
"); + " Play"); + }); + + $("a#rss-play-link").click(function() { + var file_url = $(this).attr("data-streamurl"); + var file_codec = $(this).attr("data-streamcodec"); + + var new_src='stationUrl ?>'+"embed/player?stream=file&file_url="+file_url+"&file_codec="+file_codec+"&style=premium"; + + $("#player_iframe").attr("src", new_src); });