SAAS-643: Embed Player -> Restrict the setting of an OPUS stream

This commit is contained in:
drigato 2015-03-16 11:29:24 -04:00
parent 694430f542
commit dc0855de18
3 changed files with 9 additions and 1 deletions

View File

@ -11,7 +11,12 @@ class EmbeddablePlayerController extends Zend_Controller_Action
{
$form = new Application_Form_EmbeddablePlayer();
$this->view->form = $form;
if ($form->getElement('player_stream_url')->getAttrib('numberOfEnabledStreams') > 0) {
$this->view->form = $form;
} else {
$this->view->errorMsg = "You need to enable at least one MP3, AAC, or OGG stream to use this feature.";
}
}
public function embedCodeAction()

View File

@ -16,6 +16,7 @@ class Application_Form_EmbeddablePlayer extends Zend_Form_SubForm
$streamURL = new Zend_Form_Element_Radio('player_stream_url');
$urlOptions = Array();
foreach(Application_Model_StreamSetting::getEnabledStreamUrls() as $type => $url) {
if ($type == "opus") continue;
$urlOptions[$url] = $type;
}
$streamURL->setMultiOptions(
@ -24,6 +25,7 @@ class Application_Form_EmbeddablePlayer extends Zend_Form_SubForm
$streamURL->setValue(array_keys($urlOptions)[0]);
$streamURL->setLabel(_('Select stream:'));
$streamURL->setAttrib('codec', array_values($urlOptions)[0]);
$streamURL->setAttrib('numberOfEnabledStreams', sizeof($urlOptions));
$this->addElement($streamURL);
$url = $streamURL->getValue();

View File

@ -6,6 +6,7 @@
<div style="clear:both"></div>
<?php echo $this->errorMsg; ?>
<?php echo $this->form; ?>
<br />