Resources::load_videojs()


Source

File: classes/Resources.php

	public function load_videojs(){

		if ( is_dozent_course() || is_dozent_single_lecture() ) {

			if ( ! apply_filters( 'load_dozent_videojs', true ) ){
				return;
			}

			$video_type = dozent_has_video( null, 'source' );
			if ( ! $video_type || $video_type === 'embedded' ){
				return;
			}

			wp_enqueue_style( 'dozent-videojs', DOZENT_URL . "assets/plugins/video-js/video-js.min.css", [], DOZENT_VERSION );
			wp_enqueue_script( 'dozent-videojs', DOZENT_URL . "assets/plugins/video-js/video.min.js", [], DOZENT_VERSION, true );

			if ( $video_type === 'youtube' ){
				wp_enqueue_script( 'dozent-videojs-youtube', DOZENT_URL . "assets/plugins/video-js/Youtube.min.js", [ 'dozent-videojs' ], DOZENT_VERSION, true );
			}

			if ( $video_type === 'vimeo' ){
				wp_enqueue_script( 'dozent-videojs-vimeo', DOZENT_URL ."assets/plugins/video-js/Vimeo.min.js", [ 'dozent-videojs' ], DOZENT_VERSION, true );
			}

			add_filter( 'dozent_body_class' , [ $this, 'add_body_class_video' ] );

		}
	}