| @@ -16,8 +16,25 @@ | ||
| 16 | 16 | */ |
| 17 | 17 | class Embed { |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | + * Embeddable background video providers. | |
| 21 | + * | |
| 22 | + * Holds the list of providers whose background video is rendered as an embedded | |
| 23 | + * iframe player (.elementor-background-video-embed) rather than a hosted <video> | |
| 24 | + * element. This is intentionally a SUBSET of the providers recognized by | |
| 25 | + * get_video_properties() — the frontend background-video handler only mounts | |
| 26 | + * YouTube/Vimeo players, so other providers must fall through to hosted rendering. | |
| 27 | + * | |
| 28 | + * @access private | |
| 29 | + * @static | |
| 30 | + * | |
| 31 | + * @var array Embeddable background video provider slugs. | |
| 32 | + */ | |
| 33 | + private static $video_embed_providers = [ 'youtube', 'vimeo' ]; | |
| 34 | + | |
| 35 | + | |
| 36 | + /** | |
| 20 | 37 | * Provider match masks. |
| 21 | 38 | * |
| 22 | 39 | * Holds a list of supported providers with their URL structure in a regex format. |
| 23 | 40 | * |
| @@ -84,8 +101,24 @@ | ||
| 84 | 101 | } |
| 85 | 102 | } |
| 86 | 103 | |
| 87 | 104 | return null; |
| 105 | + } | |
| 106 | + | |
| 107 | + /** | |
| 108 | + * Is embeddable background video. | |
| 109 | + * | |
| 110 | + * Whether a given video URL belongs to a provider that the frontend | |
| 111 | + * background-video handler renders as an embedded iframe player. | |
| 112 | + * | |
| 113 | + * @param string $video_url Video URL. | |
| 114 | + * | |
| 115 | + * @return bool | |
| 116 | + **/ | |
| 117 | + public static function is_embed_video( $video_url ) { | |
| 118 | + $video_properties = self::get_video_properties( $video_url ); | |
| 119 | + | |
| 120 | + return null !== $video_properties && in_array( $video_properties['provider'], self::$video_embed_providers, true ); | |
| 88 | 121 | } |
| 89 | 122 | |
| 90 | 123 | /** |
| 91 | 124 | * Get embed URL. |