su_shortcode_video

The shortcodes-ultimate su shortcode video function.

Published Date - February 15, 2021

Description

su_shortcode_video( $atts, $content );

Parameters

  1. $atts

  2. $content


Usage

The following example is for adding a hook callback.

if ( !function_exists( 'su_shortcode_video' ) ) {
    require_once ABSPATH . PLUGINDIR . 'shortcodes-ultimateshortcodes-ultimate/includes/shortcodes/video.php';
}

// The input(s). 
$atts = null;
$content = null;

// NOTICE! Understand what this does before running.
$result = su_shortcode_video( $atts, $content );
            

Defined

The function is defined in the following location(s).

shortcodes-ultimate/includes/shortcodes/video.php

function su_shortcode_video( $atts = null, $content = null ) {

	$atts = shortcode_atts( array(
			'url'      => false,
			'poster'   => false,
			'title'    => '',
			'width'    => 600,
			'height'   => 300,
			'controls' => 'yes',
			'autoplay' => 'no',
			'loop'     => 'no',
			'class'    => ''
		), $atts, 'video' );

	if ( ! $atts['url'] ) {
		return su_error_message( 'Video', __( 'please specify correct url', 'shortcodes-ultimate' ) );
	}

	$atts['url'] = su_do_attribute( $atts['url'] );

	$id = uniqid( 'su_video_player_' );

	if ( ! $atts['url'] ) {
		return su_error_message( 'Video', __( 'please specify correct url', 'shortcodes-ultimate' ) );
	}

	$title = $atts['title']
		? '<div class="jp-title">' . $atts['title'] . '</div>'
		: '';

	su_query_asset( 'css', 'su-shortcodes' );
	su_query_asset( 'js', 'jquery' );
	su_query_asset( 'js', 'jplayer' );
	su_query_asset( 'js', 'su-shortcodes' );

	return '<div style="width:' . $atts['width'] . 'px"><div id="' . $id . '" class="su-video jp-video su-video-controls-' . $atts['controls'] . su_get_css_class( $atts ) . '" data-id="' . $id . '" data-video="' . $atts['url'] . '" data-swf="' . plugins_url( 'vendor/jplayer/jplayer.swf', SU_PLUGIN_FILE ) . '" data-autoplay="' . $atts['autoplay'] . '" data-loop="' . $atts['loop'] . '" data-poster="' . $atts['poster'] . '"><div id="' . $id . '_player" class="jp-jplayer" style="width:' . $atts['width'] . 'px;height:' . $atts['height'] . 'px"></div>' . $title . '<div class="jp-start jp-play"></div><div class="jp-gui"><div class="jp-interface"><div class="jp-progress"><div class="jp-seek-bar"><div class="jp-play-bar"></div></div></div><div class="jp-current-time"></div><div class="jp-duration"></div><div class="jp-controls-holder"><span class="jp-play"></span><span class="jp-pause"></span><span class="jp-mute"></span><span class="jp-unmute"></span><span class="jp-full-screen"></span><span class="jp-restore-screen"></span><div class="jp-volume-bar"><div class="jp-volume-bar-value"></div></div></div></div></div></div></div>';

}