2015-02-12 20:08:06 +01:00
|
|
|
<?php
|
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
define('OPUS', 'opus');
|
2015-04-07 23:49:21 +02:00
|
|
|
|
2015-04-08 20:01:57 +02:00
|
|
|
class Application_Form_Player extends Zend_Form_SubForm
|
2015-02-12 20:08:06 +01:00
|
|
|
{
|
|
|
|
public function init()
|
|
|
|
{
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->setDecorators([
|
|
|
|
['ViewScript', ['viewScript' => 'form/player.phtml']],
|
|
|
|
]);
|
2015-02-12 20:08:06 +01:00
|
|
|
|
2015-04-09 20:22:50 +02:00
|
|
|
$title = new Zend_Form_Element_Text('player_title');
|
|
|
|
$title->setValue(_('Now Playing'));
|
|
|
|
$title->setLabel(_('Title:'));
|
2021-10-11 16:10:47 +02:00
|
|
|
$title->setDecorators([
|
2015-04-09 15:43:15 +02:00
|
|
|
'ViewHelper',
|
|
|
|
'Errors',
|
2021-10-11 16:10:47 +02:00
|
|
|
'Label',
|
|
|
|
]);
|
|
|
|
$title->addDecorator('Label', ['class' => 'player-title']);
|
2015-04-09 15:43:15 +02:00
|
|
|
$this->addElement($title);
|
2015-02-12 20:08:06 +01:00
|
|
|
|
2015-03-23 17:37:22 +01:00
|
|
|
$streamMode = new Zend_Form_Element_Radio('player_stream_mode');
|
|
|
|
$streamMode->setLabel(_('Select Stream:'));
|
|
|
|
$streamMode->setMultiOptions(
|
2021-10-11 16:10:47 +02:00
|
|
|
[
|
|
|
|
'auto' => _('Auto detect the most appropriate stream to use.'),
|
|
|
|
'manual' => _('Select a stream:'),
|
|
|
|
]
|
2015-03-23 17:37:22 +01:00
|
|
|
);
|
2021-10-11 16:10:47 +02:00
|
|
|
$streamMode->setValue('auto');
|
2015-03-23 17:37:22 +01:00
|
|
|
$this->addElement($streamMode);
|
|
|
|
|
2015-02-25 23:10:41 +01:00
|
|
|
$streamURL = new Zend_Form_Element_Radio('player_stream_url');
|
2015-03-23 17:37:22 +01:00
|
|
|
$opusStreamCount = 0;
|
2021-10-11 16:10:47 +02:00
|
|
|
$urlOptions = [];
|
|
|
|
foreach (Application_Model_StreamSetting::getEnabledStreamData() as $stream => $data) {
|
|
|
|
$urlOptions[$stream] = strtoupper($data['codec']) . ' - ' . $data['bitrate'] . 'kbps';
|
|
|
|
if ($data['mobile']) {
|
|
|
|
$urlOptions[$stream] .= _(' - Mobile friendly');
|
2015-03-23 21:06:35 +01:00
|
|
|
}
|
2021-10-11 16:10:47 +02:00
|
|
|
if ($data['codec'] == OPUS) {
|
|
|
|
++$opusStreamCount;
|
|
|
|
$urlOptions[$stream] .= _(' - The player does not support Opus streams.');
|
2015-03-23 17:37:22 +01:00
|
|
|
}
|
2015-02-20 21:44:25 +01:00
|
|
|
}
|
|
|
|
$streamURL->setMultiOptions(
|
|
|
|
$urlOptions
|
|
|
|
);
|
2015-02-17 17:48:43 +01:00
|
|
|
|
2015-04-07 23:49:21 +02:00
|
|
|
// Set default value to the first non-opus stream we find
|
2015-03-23 17:37:22 +01:00
|
|
|
foreach ($urlOptions as $o => $v) {
|
2015-04-07 23:49:21 +02:00
|
|
|
if (strpos(strtolower($v), OPUS) !== false) {
|
2015-03-23 17:37:22 +01:00
|
|
|
continue;
|
|
|
|
}
|
2021-10-11 16:10:47 +02:00
|
|
|
$streamURL->setValue($o);
|
|
|
|
|
|
|
|
break;
|
2015-03-23 17:37:22 +01:00
|
|
|
}
|
|
|
|
|
Feature: Support php7.4 (#1354)
* Run CI tests against php 7.4
* Sort composer dependencies
* Remove unused Aws S3 php library
* Pin simplepie dependency to ^1.5
* Pin getid3 dependency to ^1.9
* Pin composer semver to ^3.2
* Pin php-amqplib to ^2.12
* Drop sentry logging support
* Update composer dependencies
* Move propel regenerate to Makefile
* Regenerate propel files with v1.7.0
* Pin propel orm to ^1.7
* Regenerate propel files with v1.7.2
* fix: generator_version in airtime-conf-production.php
* Replace propel/propel1 with jooola/propel1
* Regenerate propel files with v1.7.3-dev
* Fix php7.4 compatibility
Using php-cs-fixer:
'@PhpCsFixer' => true,
'concat_space' => ['spacing' => 'one'],
'ordered_class_elements' => false,
'yoda_style' => false,
'@PHP74Migration' => true,
'assign_null_coalescing_to_coalesce_equal' => false,
'ternary_to_null_coalescing' => false,
'heredoc_indentation' => false,
'@PHP74Migration:risky' => true,
'declare_strict_types' => false,
'void_return' => false,
'use_arrow_functions' => false,
* Fix pre-commit
2021-10-17 17:19:53 +02:00
|
|
|
$streamURL->setAttrib('numberOfEnabledStreams', count($urlOptions) - $opusStreamCount);
|
2015-04-08 20:01:57 +02:00
|
|
|
$streamURL->removeDecorator('label');
|
2015-03-23 17:37:22 +01:00
|
|
|
$this->addElement($streamURL);
|
2015-03-12 20:45:53 +01:00
|
|
|
|
2015-04-09 15:43:15 +02:00
|
|
|
$embedSrc = new Zend_Form_Element_Textarea('player_embed_src');
|
2021-10-11 16:10:47 +02:00
|
|
|
$embedSrc->setAttrib('readonly', 'readonly');
|
|
|
|
$embedSrc->setAttrib('class', 'embed-player-text-box');
|
2015-04-09 15:43:15 +02:00
|
|
|
$embedSrc->setAttrib('cols', '40')
|
2022-01-23 19:15:55 +01:00
|
|
|
->setAttrib('rows', '4');
|
2021-10-11 16:10:47 +02:00
|
|
|
$embedSrc->setLabel(_('Embeddable code:'));
|
2015-04-09 20:22:50 +02:00
|
|
|
$embedSrc->setDescription(_("Copy this code and paste it into your website's HTML to embed the player in your site."));
|
2022-07-07 23:32:43 +02:00
|
|
|
$embedSrc->setValue('<iframe frameborder="0" width="280" height="216" src="' . Config::getPublicUrl() . 'embed/player?stream=auto&title=Now Playing"></iframe>');
|
2015-03-12 20:45:53 +01:00
|
|
|
$this->addElement($embedSrc);
|
|
|
|
|
2015-03-16 18:24:58 +01:00
|
|
|
$previewLabel = new Zend_Form_Element_Text('player_preview_label');
|
2021-10-11 16:10:47 +02:00
|
|
|
$previewLabel->setLabel(_('Preview:'));
|
|
|
|
$previewLabel->setDecorators([
|
2020-03-22 13:31:32 +01:00
|
|
|
'ViewHelper',
|
|
|
|
'Errors',
|
2021-10-11 16:10:47 +02:00
|
|
|
'Label',
|
|
|
|
]);
|
|
|
|
$previewLabel->addDecorator('Label', ['class' => 'preview-label']);
|
2015-03-16 18:24:58 +01:00
|
|
|
$this->addElement($previewLabel);
|
2015-02-12 20:08:06 +01:00
|
|
|
}
|
2015-04-09 18:25:27 +02:00
|
|
|
}
|