Output audio files in the frontend
In addition to images and videos, audio files can also be added editorially in the backend under the Relations tab. These are not displayed in the output by default. It is necessary to customize partials and add another one.
1. refer to the individual partial directory in the TypoScript instead of that of the extension.
2. create a new file "MediaAudio.html" with the following code and place it below your own partial directory: .../Partials/Detail/MediaAudio.html
<div class="mediaelement" xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers">
<div class="mediaelement-audio">
<f:media class="audio-embed-item" file="{mediaElement}" alt="{mediaElement.originalResource.properties.alternative}" title="{mediaElement.originalResource.properties.title}"/>
</div>
<f:if condition="{mediaElement.description}">
<div class="medialement-alternative-content">
<p class="news-img-caption">
{mediaElement.description}
</p>
</div>
</f:if>
</div>
...
<div class="news-img-wrap">
<n:link newsItem="{newsItem}" settings="{settings}" title="{newsItem.title}">
<f:alias map="{mediaElement: '{newsItem.mediaPreviews.0}'}">
...
<f:if condition="{mediaElement.originalResource.type} == 3">
<f:render partial="Detail/MediaAudio" arguments="{mediaElement: mediaElement}"/>
</f:if>
...
</f:alias>
</n:link>
</div>
...This page contains automatically translated content.
Updated: 17.07.2024
