Automattic\WooCommerce\EmailEditor\Integrations\Core\Renderer\Blocks

Embed::get_video_thumbnail_url │ private │ WC 1.0

Get video thumbnail URL for supported providers.

Метод класса: Embed{}

Хуков нет.

Возвращает

string. Thumbnail URL or empty string.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->get_video_thumbnail_url( $url, $provider ): string;
$url(строка) (обязательный)
Video URL.
$provider(строка) (обязательный)
Provider name.

Код Embed::get_video_thumbnail_url() WC 11.2.2

private function get_video_thumbnail_url( string $url, string $provider ): string {
	// YouTube thumbnails follow a predictable URL pattern, so no HTTP request is needed.
	if ( 'youtube' === $provider ) {
		$thumbnail = $this->get_youtube_thumbnail( $url );
		if ( '' !== $thumbnail ) {
			return $thumbnail;
		}
		// YouTube URLs without an extractable video ID (e.g. playlists)
		// fall through to the oEmbed thumbnail lookup below.
	}

	// All other supported video providers (VideoPress, Vimeo, TikTok, Dailymotion)
	// expose their thumbnails through the WordPress oEmbed API.
	// Returns empty string on failure, which triggers the link fallback.
	return $this->get_oembed_thumbnail( $url );
}