From 60835892c07b1d4fefa2b73d94396f98ca636397 Mon Sep 17 00:00:00 2001 From: Vencislav Atanasov Date: Wed, 30 Oct 2024 23:53:59 +0200 Subject: [PATCH] Add Video.js shortcode --- functions.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/functions.php b/functions.php index 2d5305b..5aceb6d 100644 --- a/functions.php +++ b/functions.php @@ -56,6 +56,7 @@ function register_shortcodes(){ add_shortcode('sponsors', 'sponsors_shortcode'); add_shortcode('partners', 'partners_shortcode'); add_shortcode('transport', 'transport_shortcode'); + add_shortcode('stream-player', 'stream_player_shortcode'); } add_action( 'init', 'register_shortcodes'); @@ -203,6 +204,30 @@ function transport_shortcode() { } +function stream_player_shortcode($params = []) { + wp_enqueue_style('video.js', 'https://unpkg.com/video.js/dist/video-js.css'); + wp_enqueue_script('video.js', 'https://unpkg.com/video.js/dist/video.min.js'); + + $params = [ + 'host' => 'stream.openfest.org', + 'track' => 'hall-a', + ...$params, + ]; + + $urlPrefix = 'https://' . $params['host'] . '/'; + + ob_start(); +?> + +