FluidTYPO3\Vhs\ViewHelpers\Media\YoutubeViewHelper::getSourceUrl PHP Method

getSourceUrl() private method

Returns video source url according to provided arguments
private getSourceUrl ( string $videoId ) : string
$videoId string
return string
    private function getSourceUrl($videoId)
    {
        $src = $this->arguments['extendedPrivacy'] ? self::YOUTUBE_PRIVACY_BASEURL : self::YOUTUBE_BASEURL;
        $params = [];
        if (false === (bool) $this->arguments['showRelated']) {
            $params[] = 'rel=0';
        }
        if (true === (bool) $this->arguments['autoplay']) {
            $params[] = 'autoplay=1';
        }
        if (true === (bool) $this->arguments['hideControl']) {
            $params[] = 'controls=0';
        }
        if (true === (bool) $this->arguments['hideInfo']) {
            $params[] = 'showinfo=0';
        }
        if (true === (bool) $this->arguments['enableJsApi']) {
            $params[] = 'enablejsapi=1';
        }
        if (false === empty($this->arguments['playlist'])) {
            $params[] = 'playlist=' . $this->arguments['playlist'];
        }
        if (true === (bool) $this->arguments['loop']) {
            $params[] = 'loop=1';
        }
        if (false === empty($this->arguments['start'])) {
            $params[] = 'start=' . $this->arguments['start'];
        }
        if (false === empty($this->arguments['end'])) {
            $params[] = 'end=' . $this->arguments['end'];
        }
        if (true === (bool) $this->arguments['lightTheme']) {
            $params[] = 'theme=light';
        }
        if (false === empty($this->arguments['videoQuality'])) {
            $params[] = 'vq=' . $this->arguments['videoQuality'];
        }
        if (false === empty($this->arguments['windowMode'])) {
            $params[] = 'wmode=' . $this->arguments['windowMode'];
        }
        if (false === $this->arguments['legacyCode']) {
            $src .= '/embed/' . $videoId;
            $seperator = '?';
        } else {
            $src .= '/v/' . $videoId . '?version=3';
            $seperator = '&';
        }
        if (false === empty($params)) {
            $src .= $seperator . implode('&', $params);
        }
        return $src;
    }