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

Embed::get_video_thumbnail_url │ private │ WC 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.1.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 );
}