Description
Filter the aspect ratio used to embed a video. Since version 2.3 the real proportions of each video are detected on import and saved on the post; the aspect ratio of the player settings is the fallback for videos whose proportions are unknown. Used by the single video page, the Post Video block, the video shortcode and the playlists. Available since Video Hub 2.3.0.
Parameters
- $aspect_ratio
- (string)(required) Aspect ratio as “width x height”, like
16x9or9x16. - $video
- (\WPYTHub\Video|false)(required) The video.
- $fallback
- (string)(required) Aspect ratio from the player settings.
Examples
Embed every video as 16:9, ignoring the detected proportions.
add_filter( 'cbc_video_aspect_ratio', function( $aspect_ratio, $video, $fallback ) {
return '16x9';
}, 10, 3 );