Skip to content

Commit 1cb2038

Browse files
committed
Fix handling of video embed playback parameters.
1 parent 9dd4dd5 commit 1cb2038

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/inc/class-cloudflare-stream-api.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,11 @@ public function get_video_embed( $uid, $args = array(), $return_headers = false
256256

257257
$video_embed = '<div style="position: relative; padding-top: 56.25%"><iframe'
258258
. ' src="' . esc_url( $src_uri )
259-
. 'muted=' . $args['muted'] . '&'
260-
. 'preload=' . $args['preload'] . '&'
261-
. 'loop=' . $args['loop'] . '&'
262-
. 'autoplay=' . $args['autoplay'] . '&'
263-
. 'controls=' . $args['controls'] . '&'
259+
. ( filter_var( $args['muted'], FILTER_VALIDATE_BOOLEAN ) ? 'muted=true%26' : '' )
260+
. ( filter_var( $args['loop'], FILTER_VALIDATE_BOOLEAN ) ? 'loop=true%26' : '' )
261+
. ( filter_var( $args['autoplay'], FILTER_VALIDATE_BOOLEAN ) ? 'autoplay=true%26' : '' )
262+
. ( filter_var( $args['preload'], FILTER_VALIDATE_BOOLEAN ) ? 'preload=auto%26' : '' )
263+
. ( filter_var( $args['controls'], FILTER_VALIDATE_BOOLEAN ) || ! isset( $args['controls'] ) || strlen( trim( $args['controls'] ) ) === 0 ? '' : 'controls=false%26' )
264264
. 'poster=' . esc_url( 'https://' . $media_domain . '/' . $uid . '/thumbnails/thumbnail.jpg' ) . '"'
265265
. ' style="border: none; position: absolute; top: 0; height: 100%; width: 100%" '
266266
. 'allow="accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture;" '

0 commit comments

Comments
 (0)