'',
'autoplay' => 'yes',
'border_radius_bottom_left' => '',
'border_radius_bottom_right' => '',
'border_radius_top_left' => '',
'border_radius_top_right' => '',
'box_shadow' => 'no',
'box_shadow_blur' => '',
'box_shadow_color' => '',
'box_shadow_horizontal' => '',
'box_shadow_spread' => '',
'box_shadow_vertical' => '',
'controls' => $fusion_settings->get( 'video_controls' ),
'class' => '',
'css_id' => '',
'end_time' => '',
'hide_on_mobile' => fusion_builder_default_visibility( 'string' ),
'loop' => 'yes',
'margin_top' => '',
'margin_bottom' => '',
'mute' => 'yes',
'overlay_color' => '',
'preload' => $fusion_settings->get( 'video_preload' ),
'preview_image' => '',
'start_time' => '',
'track_tags' => '',
'video' => '',
'video_webm' => '',
'width' => $fusion_settings->get( 'video_max_width' ),
];
}
/**
* Maps settings to param variables.
*
* @static
* @access public
* @since 2.1
* @return array
*/
public static function settings_to_params() {
return [
'video_max_width' => 'width',
'video_controls' => 'controls',
'video_preload' => 'preload',
];
}
/**
* Render the shortcode.
*
* @access public
* @since 2.1
* @param array $args Shortcode parameters.
* @param string $content Content between shortcode.
* @return string HTML output.
*/
public function render( $args, $content = '' ) {
$defaults = FusionBuilder::set_shortcode_defaults( self::get_element_defaults(), $args, 'fusion_video' );
$content = apply_filters( 'fusion_shortcode_content', $content, 'fusion_video', $args );
$border_radius_top_left = $defaults['border_radius_top_left'] ? fusion_library()->sanitize->get_value_with_unit( $defaults['border_radius_top_left'] ) : '0px';
$border_radius_top_right = $defaults['border_radius_top_right'] ? fusion_library()->sanitize->get_value_with_unit( $defaults['border_radius_top_right'] ) : '0px';
$border_radius_bottom_right = $defaults['border_radius_bottom_right'] ? fusion_library()->sanitize->get_value_with_unit( $defaults['border_radius_bottom_right'] ) : '0px';
$border_radius_bottom_left = $defaults['border_radius_bottom_left'] ? fusion_library()->sanitize->get_value_with_unit( $defaults['border_radius_bottom_left'] ) : '0px';
$border_radius = $border_radius_top_left . ' ' . $border_radius_top_right . ' ' . $border_radius_bottom_right . ' ' . $border_radius_bottom_left;
$border_radius = ( '0px 0px 0px 0px' === $border_radius ) ? '' : $border_radius;
$defaults['border_radius'] = $border_radius;
// Box shadow.
if ( 'yes' === $defaults['box_shadow'] ) {
$defaults['box_shadow'] = esc_attr( trim( Fusion_Builder_Box_Shadow_Helper::get_box_shadow_styles( $defaults ) ) );
}
$this->args = $defaults;
$html = '
';
$html .= '
';
$html .= '';
$html .= '
';
$html .= '
';
$this->on_render();
return apply_filters( 'fusion_element_video_content', $html, $args );
}
/**
* Adds the HTML track tags.
*
* @access public
* @since 4.11.8
* @return string
*/
public function add_track_tags() {
if ( empty( $this->args['track_tags'] ) ) {
return '';
}
$tracks = json_decode( base64_decode( $this->args['track_tags'] ), true );
$track_html = '';
if ( is_array( $tracks ) && ! empty( $tracks ) ) {
foreach ( $tracks as $track ) {
if ( ! empty( $track['track_src'] ) ) {
$track_html .= '