Bug #97446
closedVimeoHelper and VimeoRenderer build wrong URLs
100%
Description
In Vimeo you can copy a link to a video in two different (relevant) ways:
Copy Video Link returns scheme
vimeo.com/<videocode>/<optionalPrivateCode>
Copy embed code returns scheme
<iframe src="https://player.vimeo.com/video/<videocode>?h=<optionalPrivateCode>" ... ></iframe>
So here are 2 problems to solve:
1. The regex in \TYPO3\CMS\Core\Resource\OnlineMedia\Helpers\VimeoHelper::transformUrlToFile
must adapted to also recognize the code of the embed snippet.
2. Storing (in \TYPO3\CMS\Core\Resource\Rendering\VimeoHelper::transformUrlToFile()
) our outputting (in VimeoRenderer::createVimeoUrl()
) must be adapted so that the created URL contains the paramater h
(so .../<videocode>?h=<optionalPrivateCode>&...
instead of .../<videocode>/<optionalPrivateCode>?...
Under the condition that the two parts are still stored with /
a solution would be to write https://github.com/TYPO3/typo3/blob/main/typo3/sysext/core/Classes/Resource/Rendering/VimeoRenderer.php#L155
$videocode = $videoId; if(str_contains('/', $videoId)){ $videoIdElements = explode('/',$videoId); $videocode = $videoIdElements[0]; $optionalPrivateCode = $videoIdElements[1]; $urlParams[] = 'h=' . $optionalPrivateCode; } return sprintf('https://player.vimeo.com/video/%s?%s', $videocode, implode('&', $urlParams));
But I am sure here are people capable to make it more elegant...