From ed891fb145647ad7cd3d222fde6fc15748af36a1 Mon Sep 17 00:00:00 2001 From: drigato Date: Wed, 18 Mar 2015 14:23:38 -0400 Subject: [PATCH] Committing lots of trial and error embed player code changes --- .../EmbeddableplayerController.php | 14 +++++--- .../application/forms/EmbeddablePlayer.php | 4 ++- .../scripts/embeddableplayer/embed-code.phtml | 35 ++++++++++++++----- .../scripts/embeddableplayer/index.phtml | 4 +-- .../views/scripts/form/embeddableplayer.phtml | 22 ++++++++++++ airtime_mvc/public/css/embeddableplayer.css | 14 ++++++++ .../embeddableplayer/embeddableplayer.js | 28 +++++++++++++++ .../public/js/airtime/embeddableplayer/mrp.js | 3 +- 8 files changed, 107 insertions(+), 17 deletions(-) create mode 100644 airtime_mvc/public/css/embeddableplayer.css create mode 100644 airtime_mvc/public/js/airtime/embeddableplayer/embeddableplayer.js diff --git a/airtime_mvc/application/controllers/EmbeddableplayerController.php b/airtime_mvc/application/controllers/EmbeddableplayerController.php index ec16317b5..6c2ccfbd8 100644 --- a/airtime_mvc/application/controllers/EmbeddableplayerController.php +++ b/airtime_mvc/application/controllers/EmbeddableplayerController.php @@ -12,6 +12,10 @@ class EmbeddablePlayerController extends Zend_Controller_Action $CC_CONFIG = Config::getConfig(); $baseUrl = Application_Common_OsPath::getBaseDir(); $this->view->headLink()->appendStylesheet($baseUrl.'css/embeddableplayer.css?'.$CC_CONFIG['airtime_version']); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/embeddableplayer/mrp.js?'.$CC_CONFIG['airtime_version']); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/embeddableplayer/embeddableplayer.js?'.$CC_CONFIG['airtime_version']); + + $form = new Application_Form_EmbeddablePlayer(); if ($form->getElement('player_stream_url')->getAttrib('numberOfEnabledStreams') > 0) { @@ -28,11 +32,13 @@ class EmbeddablePlayerController extends Zend_Controller_Action $request = $this->getRequest(); - $this->view->mrp_js = Application_Common_HTTPHelper::getStationUrl() . "/js/airtime/embeddableplayer/mrp.js"; - $this->view->muses_swf = Application_Common_HTTPHelper::getStationUrl() . "/js/airtime/embeddableplayer/muses.swf"; - $this->view->skin = Application_Common_HTTPHelper::getStationUrl() . "/js/airtime/embeddableplayer/ffmp3-mcclean.xml"; + $this->view->mrp_js = Application_Common_HTTPHelper::getStationUrl() . "js/airtime/embeddableplayer/mrp.js"; + $this->view->muses_swf = Application_Common_HTTPHelper::getStationUrl() . "js/airtime/embeddableplayer/muses.swf"; + $this->view->skin = Application_Common_HTTPHelper::getStationUrl() . "js/airtime/embeddableplayer/ffmp3-mcclean.xml"; $this->view->codec = $request->getParam('codec'); - $this->view->streamURL = $request->getParam('url'); + //$this->view->streamURL = $request->getParam('url'); + //$stream = $request->getParam('stream'); + $this->view->streamURL = "http://127.0.0.1:8000/airtime_128"; $this->view->displayMetadata = $request->getParam('display_metadata'); } } \ No newline at end of file diff --git a/airtime_mvc/application/forms/EmbeddablePlayer.php b/airtime_mvc/application/forms/EmbeddablePlayer.php index a77ae5f1d..febf1379a 100644 --- a/airtime_mvc/application/forms/EmbeddablePlayer.php +++ b/airtime_mvc/application/forms/EmbeddablePlayer.php @@ -22,6 +22,7 @@ class Application_Form_EmbeddablePlayer extends Zend_Form_SubForm $streamURL->setMultiOptions( $urlOptions ); + Logging::info($urlOptions); $streamURL->setValue(array_keys($urlOptions)[0]); $streamURL->setLabel(_('Select stream:')); $streamURL->setAttrib('codec', array_values($urlOptions)[0]); @@ -33,8 +34,9 @@ class Application_Form_EmbeddablePlayer extends Zend_Form_SubForm $embedSrc = new Zend_Form_Element_Text('player_embed_src'); $embedSrc->setAttrib("readonly", "readonly"); - $embedSrc->setValue(''); $embedSrc->setAttrib("class", "embed-player-text-box"); + //$embedSrc->setValue(''); + $embedSrc->setValue(''); $embedSrc->removeDecorator('label'); $this->addElement($embedSrc); diff --git a/airtime_mvc/application/views/scripts/embeddableplayer/embed-code.phtml b/airtime_mvc/application/views/scripts/embeddableplayer/embed-code.phtml index 73db907b7..cc5e96804 100644 --- a/airtime_mvc/application/views/scripts/embeddableplayer/embed-code.phtml +++ b/airtime_mvc/application/views/scripts/embeddableplayer/embed-code.phtml @@ -3,16 +3,33 @@ + + - - - - - - - - - + + + \ No newline at end of file diff --git a/airtime_mvc/application/views/scripts/embeddableplayer/index.phtml b/airtime_mvc/application/views/scripts/embeddableplayer/index.phtml index 7a069af6d..e4c37849b 100644 --- a/airtime_mvc/application/views/scripts/embeddableplayer/index.phtml +++ b/airtime_mvc/application/views/scripts/embeddableplayer/index.phtml @@ -1,9 +1,9 @@ -
+

- +
errorMsg; ?> form; ?> diff --git a/airtime_mvc/application/views/scripts/form/embeddableplayer.phtml b/airtime_mvc/application/views/scripts/form/embeddableplayer.phtml index 5153189e8..dacb80cd7 100644 --- a/airtime_mvc/application/views/scripts/form/embeddableplayer.phtml +++ b/airtime_mvc/application/views/scripts/form/embeddableplayer.phtml @@ -8,9 +8,31 @@ element->getElement('player_stream_url'); ?> element->getElement('player_preview_label')->renderLabel(); ?> + +
+
+
play
+
stop
+
+ + +
element->getElement('player_embed_src')->getValue(); ?>
+ + \ No newline at end of file diff --git a/airtime_mvc/public/css/embeddableplayer.css b/airtime_mvc/public/css/embeddableplayer.css new file mode 100644 index 000000000..a1e12cbc0 --- /dev/null +++ b/airtime_mvc/public/css/embeddableplayer.css @@ -0,0 +1,14 @@ +.embed-player-text-box { + padding-right: 0px !important; + width: 100% !important; +} +.embed-player-form { + width: 70%; +} +.embed-player-form dd { + width: 100% !important; + float: left; + margin: 0; + padding: 4px 0px 4px 0px; +} + diff --git a/airtime_mvc/public/js/airtime/embeddableplayer/embeddableplayer.js b/airtime_mvc/public/js/airtime/embeddableplayer/embeddableplayer.js new file mode 100644 index 000000000..ece8902a3 --- /dev/null +++ b/airtime_mvc/public/js/airtime/embeddableplayer/embeddableplayer.js @@ -0,0 +1,28 @@ +function generateEmbedSrc() +{ + document.getElementById('embed_player_preview').textContent=""; +} + +function setupPlayer() +{ + MRP.insert({ + 'url':"http://127.0.0.1:8000/airtime_128", + 'codec':"mp3", + 'volume':100, + 'jsevents':true, + 'autoplay':false, + 'buffering':5, + 'title':'test', + 'bgcolor':'#FFFFFF', + 'skin':-1, + 'width':180, + 'height':60 + }); +} + +window.onload = function() { + setupPlayer(); + document.getElementById('player_display_track_metadata').onchange = generateEmbedSrc; + document.getElementById('muses_play').click = MRP.play(); + document.getElementById('muses_stop').click = MRP.stop(); +} diff --git a/airtime_mvc/public/js/airtime/embeddableplayer/mrp.js b/airtime_mvc/public/js/airtime/embeddableplayer/mrp.js index 74bc30836..3308a8f55 100644 --- a/airtime_mvc/public/js/airtime/embeddableplayer/mrp.js +++ b/airtime_mvc/public/js/airtime/embeddableplayer/mrp.js @@ -203,7 +203,8 @@ c + ("&skin=" + g.getSkin(a.skin, !0)), c = c + ("&title=" + a.title), c = c + ("&welcome=" + a.welcome), - b = g.getScriptBaseHREF() + "/muses-hosted.swf", + //b = g.getScriptBaseHREF() + "/muses-hosted.swf", + b = "http://localhost/js/airtime/embeddableplayer/muses.swf", e = 'width="' + a.width + '" height="' + a.height + '" '; null != a.bgcolor && (e += 'bgcolor="' + a.bgcolor + '" '); var f = '",