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

Embed::get_video_thumbnail_urlprivateWC 1.0

Get video thumbnail URL for supported providers.

Method of the class: Embed{}

No Hooks.

Returns

String. Thumbnail URL or empty string.

Usage

// private - for code of main (parent) class only
$result = $this->get_video_thumbnail_url( $url, $provider ): string;
$url(string) (required)
Video URL.
$provider(string) (required)
Provider name.

Embed::get_video_thumbnail_url() code WC 11.0.0

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 ) {
		return $this->get_youtube_thumbnail( $url );
	}

	// 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 );
}