2 namespace TYPO3\CMS\Core\Resource\Rendering;
67 public function render(
FileInterface $file, $width, $height, array $options = array(), $usedPathsRelativeToCurrentScript =
false)
71 if (!isset($options[
'autoplay']) && $file instanceof
FileReference) {
73 if ($autoplay !== null) {
74 $options[
'autoplay'] = $autoplay;
78 $additionalAttributes = array();
79 if (!isset($options[
'controls']) || !empty($options[
'controls'])) {
80 $additionalAttributes[] =
'controls';
82 if (!empty($options[
'autoplay'])) {
83 $additionalAttributes[] =
'autoplay';
85 if (!empty($options[
'muted'])) {
86 $additionalAttributes[] =
'muted';
88 if (!empty($options[
'loop'])) {
89 $additionalAttributes[] =
'loop';
91 foreach ([
'class',
'dir',
'id',
'lang',
'style',
'title',
'accesskey',
'tabindex',
'onclick',
'preload'] as $key) {
92 if (!empty($options[$key])) {
93 $additionalAttributes[] = $key .
'="' . htmlspecialchars($options[$key]) .
'"';
98 '<audio%s><source src="%s" type="%s"></audio>',
99 empty($additionalAttributes) ?
'' :
' ' . implode(
' ', $additionalAttributes),
100 htmlspecialchars($file->
getPublicUrl($usedPathsRelativeToCurrentScript)),