Helper::enqueue_player( bool $include_js = true, bool|string $js_dependency = false, bool|string $css_dependency = false )

Add video player script to page.


Description

Enqueue the Vimeotheque player script and styling into the page.


Parameters

$include_js

(Optional) Enqueue the player JavaScript (true) or skip it (false).

Default value: true

$js_dependency

(Optional) Add additional JavaScript handle that depends on the player script.

Default value: false

$css_dependency

(Optional) Add additional styles handle that depend on the player style.

Default value: false


Return

(array)


Source

File: includes/libs/helper.class.php

	public static function enqueue_player( $include_js = true,  $js_dependency = false, $css_dependency = false  ){
		$handles = [
			'js' => false,
			'css' => 'cvm-video-player'
		];

		if( $include_js ) {
			wp_register_script(
				'vimeo-video-player-sdk',
				'https://player.vimeo.com/api/player.js',
				false,
				'2.11'
			);

			$js_dependency = $js_dependency ? ['jquery', 'vimeo-video-player-sdk', $js_dependency] : ['jquery', 'vimeo-video-player-sdk'];

			wp_enqueue_script(
				'cvm-video-player',
				VIMEOTHEQUE_URL . 'assets/back-end/js/apps/player/app.build.js',
				$js_dependency,
				'1.0'
			);
			$handles['js'] = 'cvm-video-player';
		}

		$css_dependency = $css_dependency ? [ $css_dependency ] : false;
		wp_enqueue_style(
			'cvm-video-player',
			VIMEOTHEQUE_URL . 'assets/front-end/css/video-player.css',
			$css_dependency
		);

		return $handles;
	}

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!