2 namespace TYPO3\CMS\Core\Resource\Rendering;
67 if ($this->onlineMediaHelper === null) {
70 $orgFile = $orgFile->getOriginalFile();
72 if ($orgFile instanceof
File) {
75 $this->onlineMediaHelper =
false;
91 public function render(
FileInterface $file, $width, $height, array $options = null, $usedPathsRelativeToCurrentScript =
false)
95 if ($autoplay !== null) {
96 $options[
'autoplay'] = $autoplay;
100 $urlParams = array(
'autohide=1');
101 if (!isset($options[
'controls']) || !empty($options[
'controls'])) {
102 $urlParams[] =
'controls=2';
104 if (!empty($options[
'autoplay'])) {
105 $urlParams[] =
'autoplay=1';
107 if (!empty($options[
'loop'])) {
108 $urlParams[] =
'loop=1';
110 if (!isset($options[
'enablejsapi']) || !empty($options[
'enablejsapi'])) {
113 $urlParams[] =
'showinfo=' . (int)!empty($options[
'showinfo']);
115 if ($file instanceof FileReference) {
116 $orgFile = $file->getOriginalFile();
123 '//www.youtube%s.com/embed/%s?%s',
124 !empty($options[
'no-cookie']) ?
'-nocookie' :
'',
126 implode(
'&', $urlParams)
129 $attributes = [
'allowfullscreen'];
130 if ((
int)$width > 0) {
131 $attributes[] =
'width="' . (int)$width .
'"';
133 if ((
int)$height > 0) {
134 $attributes[] =
'height="' . (int)$height .
'"';
136 if (is_object(
$GLOBALS[
'TSFE']) &&
$GLOBALS[
'TSFE']->config[
'config'][
'doctype'] !==
'html5') {
137 $attributes[] =
'frameborder="0"';
139 foreach ([
'class',
'dir',
'id',
'lang',
'style',
'title',
'accesskey',
'tabindex',
'onclick',
'poster',
'preload'] as $key) {
140 if (!empty($options[$key])) {
141 $attributes[] = $key .
'="' . htmlspecialchars($options[$key]) .
'"';
146 '<iframe src="%s"%s></iframe>',
148 empty($attributes) ?
'' :
' ' . implode(
' ', $attributes)