---
title: "Feature: #99312 - PSR-14 Event for fetching YouTube/Vimeo preview image"
manual: "TYPO3 Core Changelog"
version: "main"
permalink: "https://docs.typo3.org/permalink/changelog:feature-99312"
source: "Changelog/12.2/Feature-99312-PSR-14EventForFetchingYoutubeVimeoPreviewImage.rst"
typo3-version: "12.2"
typo3-major: 12
type: "feature"
issue: 99312
forge: "https://forge.typo3.org/issues/99312"
tags: ["Backend", "Frontend", "ext:core"]
rendered: "2026-09-20T18:31:11+00:00"
---

# Feature: #99312 - PSR-14 Event for fetching YouTube/Vimeo preview image {#feature-99312}

See [forge#99312](https://forge.typo3.org/issues/99312)

## Description {#description}

A new PSR-14 event `\TYPO3\CMS\Core\Resource\OnlineMedia\Event\AfterVideoPreviewFetchedEvent`
has been introduced. The purpose of this event is to modify the preview file
of online media previews (like YouTube and Vimeo).
If, for example, a processed file is bad (blank or outdated), this event can be
used to modify and/or update the preview file.

The event features the following methods:

-   `getFile()`: Returns the `\TYPO3\CMS\Core\Resource\File` in question
-   `getOnlineMediaId()`: Returns the video ID
-   `getPreviewImageFilename()`: Returns the filename of the preview image
-   `setPreviewImageFilename()`: Set the filename for the preview image

Registration of the event in your extension's `Services.yaml`:

**EXT:my_extension/Configuration/Services.yaml**

```yaml
MyVendor\MyExtension\EventListener\ExampleEventListener:
    tags:
      - name: event.listener
        identifier: 'exampleEventListener'
```

The corresponding event listener class:

**EXT:my_extension/Classes/EventListener/ExampleEventListener.php**

```php
namespace MyVendor\MyExtension\EventListener;

use TYPO3\CMS\Core\Resource\OnlineMedia\Event\AfterVideoPreviewFetchedEvent;

final class ExampleEventListener
{
    public function __invoke(AfterVideoPreviewFetchedEvent $event): void
    {
        $event->setPreviewImageFilename(
            '/var/www/websites/typo3temp/assets/online_media/new-preview-image.jpg'
        );
        // An extension could use this to fetch new images again.
    }
}
```

## Impact {#impact}

It is now possible to change the filename for the preview image of a YouTube
or Vimeo thumbnail image.
