From e32744668f5f1e80f509ebef94de8b847ca8a98d Mon Sep 17 00:00:00 2001 From: drigato Date: Mon, 23 Mar 2015 16:06:35 -0400 Subject: [PATCH] SAAS-661: Add mobile stream identifier on Stream Settings page --- airtime_mvc/application/forms/EmbeddablePlayer.php | 5 ++++- airtime_mvc/application/forms/StreamSettingSubForm.php | 6 ++++++ airtime_mvc/application/models/StreamSetting.php | 3 ++- .../views/scripts/form/stream-setting-form.phtml | 7 +++++++ .../public/js/airtime/embeddableplayer/embeddableplayer.js | 2 +- 5 files changed, 20 insertions(+), 3 deletions(-) diff --git a/airtime_mvc/application/forms/EmbeddablePlayer.php b/airtime_mvc/application/forms/EmbeddablePlayer.php index 537abd39a..ba7c5fce9 100644 --- a/airtime_mvc/application/forms/EmbeddablePlayer.php +++ b/airtime_mvc/application/forms/EmbeddablePlayer.php @@ -28,7 +28,10 @@ class Application_Form_EmbeddablePlayer extends Zend_Form_SubForm $opusStreamCount = 0; $urlOptions = Array(); foreach(Application_Model_StreamSetting::getEnabledStreamData() as $stream => $data) { - $urlOptions[$stream] = $data["codec"]." - ".$data["bitrate"]."kbps"; + $urlOptions[$stream] = strtoupper($data["codec"])." - ".$data["bitrate"]."kbps"; + if ($data["mobile"]) { + $urlOptions[$stream] .= " - Mobile friendly"; + } if ($data["codec"] == "opus") { $opusStreamCount += 1; $urlOptions[$stream] .=" - The player does not support Opus streams."; diff --git a/airtime_mvc/application/forms/StreamSettingSubForm.php b/airtime_mvc/application/forms/StreamSettingSubForm.php index 874f38dc5..b84adf63d 100644 --- a/airtime_mvc/application/forms/StreamSettingSubForm.php +++ b/airtime_mvc/application/forms/StreamSettingSubForm.php @@ -53,6 +53,12 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm } $this->addElement($enable); + $mobile = new Zend_Form_Element_Checkbox('mobile'); + $mobile->setLabel(_('Good for mobile?')); + $mobile->setValue($setting[$prefix.'_mobile']); + $mobile->setDecorators(array('ViewHelper')); + $this->addElement($mobile); + $type = new Zend_Form_Element_Select('type'); $type->setLabel(_("Stream Type:")) ->setMultiOptions($stream_types) diff --git a/airtime_mvc/application/models/StreamSetting.php b/airtime_mvc/application/models/StreamSetting.php index a85fad988..19a147798 100644 --- a/airtime_mvc/application/models/StreamSetting.php +++ b/airtime_mvc/application/models/StreamSetting.php @@ -94,7 +94,8 @@ class Application_Model_StreamSetting $streams[$id] = Array( "url" => "http://$host:$port/$mount", "codec" => $streamData[$prefix."type"], - "bitrate" => $streamData[$prefix."bitrate"] + "bitrate" => $streamData[$prefix."bitrate"], + "mobile" => $streamData[$prefix."mobile"] ); } return $streams; diff --git a/airtime_mvc/application/views/scripts/form/stream-setting-form.phtml b/airtime_mvc/application/views/scripts/form/stream-setting-form.phtml index 6b76ab84a..a8d61d247 100644 --- a/airtime_mvc/application/views/scripts/form/stream-setting-form.phtml +++ b/airtime_mvc/application/views/scripts/form/stream-setting-form.phtml @@ -14,6 +14,13 @@
element->getElement('enable')?>
+ +
+ +
+
+ element->getElement('mobile')?> +
diff --git a/airtime_mvc/public/js/airtime/embeddableplayer/embeddableplayer.js b/airtime_mvc/public/js/airtime/embeddableplayer/embeddableplayer.js index a07a293f2..376c64e57 100644 --- a/airtime_mvc/public/js/airtime/embeddableplayer/embeddableplayer.js +++ b/airtime_mvc/public/js/airtime/embeddableplayer/embeddableplayer.js @@ -29,7 +29,7 @@ $(document).ready(function() { $("#player_stream_url-element input[type='radio']").removeAttr("disabled"); $("input[name=player_stream_url]").each(function(i, obj) { - if ($(this).parent().text().indexOf("opus") >= 0) { + if ($(this).parent().text().toLowerCase().indexOf("opus") >= 0) { $(this).attr("disabled", "disabled"); } });