Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Wappler committed Jun 17, 2023
1 parent 17f465f commit f9640e0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
25 changes: 18 additions & 7 deletions Classes/Resource/Rendering/VideoTagRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,19 @@ public function render(FileInterface $file, $width, $height, array $options = []
{

// If autoplay isn't set manually check if $file is a FileReference take autoplay from there
if (!isset($options['autoplay']) && $file instanceof FileReference) {
if ($file instanceof FileReference) {
$autoplay = $file->getProperty('autoplay');
if ($autoplay !== null) {
$options['autoplay'] = $autoplay;
}
$muted = $file->getProperty('muted');
if ($muted !== null) {
$options['muted'] = $muted;
}
$loop = $file->getProperty('loop');
if ($loop !== null) {
$options['loop'] = $loop;
}
}

$attributes = [];
Expand All @@ -89,22 +97,25 @@ public function render(FileInterface $file, $width, $height, array $options = []
if (!empty($options['autoplay'])) {
$attributes[] = 'autoplay';
}
if (!empty($options['muted']) || $file->getProperty('muted')) {
if (!empty($options['muted']) || !empty($options['autoplay'])) {
$attributes[] = 'muted';
}
if (!empty($options['loop']) || $file->getProperty('loop')) {
if (!empty($options['loop'])) {
$attributes[] = 'loop';
}

if (!empty($options['poster'])) {
$attributes[] = 'poster="'.$options['poster'].'"';
}

if ($file->getOriginalFile()->getProperty('poster')) {
if ($file instanceof FileReference) {
$file = $file->getOriginalFile();
}
if ($file->getProperty('poster')) {
/** @var FileRepository $fileRepository */
$fileRepository = GeneralUtility::makeInstance(FileRepository::class);

$fileObjects = $fileRepository->findByRelation('sys_file_metadata', 'poster', $file->getOriginalFile()->getMetaData()['uid']);
$fileObjects = $fileRepository->findByRelation('sys_file_metadata', 'poster', $file->getMetaData()['uid']);

if (isset($fileObjects[0])) {
/** @var FileReference $posterFile */
Expand All @@ -118,12 +129,12 @@ public function render(FileInterface $file, $width, $height, array $options = []
$attributes[] = 'oncontextmenu="return false;"';

$tracks = '';
if ($file->getOriginalFile()->getProperty('tracks')) {
if ($file->getProperty('tracks')) {

/** @var FileRepository $fileRepository */
$fileRepository = GeneralUtility::makeInstance(FileRepository::class);

$fileObjects = $fileRepository->findByRelation('sys_file_metadata', 'tracks', $file->getOriginalFile()->getMetaData()['uid']);
$fileObjects = $fileRepository->findByRelation('sys_file_metadata', 'tracks', $file->getMetaData()['uid']);

/** @var FileReference $fileObject */
foreach ($fileObjects as $key => $fileObject) {
Expand Down
4 changes: 2 additions & 2 deletions ext_emconf.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

$EM_CONF[$_EXTKEY] = [
$EM_CONF['videos'] = [
'title' => 'Videos',
'description' => 'Extends video file properties and provides a player for playlists, cue points and subtitles',
'author' => 'Sven Wappler',
Expand All @@ -9,7 +9,7 @@
'author_company' => 'WapplerSystems',
'state' => 'stable',
'clearCacheOnLoad' => 1,
'version' => '12.0.1',
'version' => '12.0.2',
'constraints' => [
'depends' => [
'typo3' => '12.4.0-12.4.99',
Expand Down

0 comments on commit f9640e0

Please sign in to comment.