Player::get_output( bool $echo = true, bool $width = false )

Embed output


Parameters

$echo

(bool) (Optional)

Default value: true

$width

(bool) (Optional)

Default value: false


Return

(string|void)


Source

File: includes/libs/player/player.class.php

	public function get_output( $echo = true, $width = false ){
		if( !$this->post->is_video() ){
			return;
		}

		$_width = $width ? absint( $width ) : $this->get_embed_width();
		$height = !$width && $this->get_max_height() ? $this->get_max_height() : $this->get_embed_height( $_width );

		$css_class = $this->get_css_classes();

		$embed_content = sprintf(
			'<iframe src="%s" width="100%%" height="100%%" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>',
			$this->get_embed_url()
		);

		if( $this->options['lazy_load'] ){
			$attachment_id = get_post_thumbnail_id( $this->post->get_post()->ID );
			$img = wp_get_attachment_image_src( $attachment_id, 'full' ) ?: end( $this->post->thumbnails );
			if( $img ){
				$embed_content = sprintf(
					'<a href="#" class="vimeotheque-load-video" title="%s" data-url="%s"><img src="%s" class="video-thumbnail" />%s</a>',
					esc_attr( $this->post->get_post()->post_title ),
					$this->get_embed_url(),
					is_array( $img ) ? $img[0] : $img,
					sprintf(
						'<div class="icon" style="background-color:%s"></div>',
						esc_attr( $this->options['play_icon_color'] )
					)
				);
			}
		}

		$video_container = sprintf(
			'<div class="vimeotheque-player %s" %s style="width:%spx; height:%spx; max-width:100%%;">%s</div>',
			$css_class,
			$this->get_data_attributes(),
			$_width,
			$height,
			$embed_content
		);

		if( $echo ){
			echo $video_container;
		}

		return $video_container;
	}

Start your video site now!

Manage and coordinate your Vimeo channels, albums or videos with your WordPress website. Perfect fit for membership, portfolio, online courses or any type of video collection.

Get Vimeotheque PRO!