Add fluid video.js option

This commit is contained in:
Vencislav Atanasov 2024-10-31 00:34:15 +02:00
parent b5fbe19c7d
commit d7d02f59d5
1 changed files with 5 additions and 1 deletions

View File

@ -208,6 +208,10 @@ function stream_player_shortcode($params = []) {
wp_enqueue_style('video.js', 'https://unpkg.com/video.js/dist/video-js.css'); 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'); wp_enqueue_script('video.js', 'https://unpkg.com/video.js/dist/video.min.js');
$videoJsConfig = [
'fluid' => true,
];
$params = array_merge([ $params = array_merge([
'host' => 'stream.openfest.org', 'host' => 'stream.openfest.org',
'track' => 'hall-a', 'track' => 'hall-a',
@ -217,7 +221,7 @@ function stream_player_shortcode($params = []) {
ob_start(); ob_start();
?> ?>
<video class="video-js vjs-fill" controls data-setup="{}"> <video class="video-js vjs-fill" controls data-setup="<?php echo htmlspecialchars(json_encode($videoJsConfig)); ?>">
<source type="application/x-mpegURL" src="<?php echo $urlPrefix, 'hls/', $params['track']; ?>.m3u8"></source> <source type="application/x-mpegURL" src="<?php echo $urlPrefix, 'hls/', $params['track']; ?>.m3u8"></source>
<source type="application/dash+xml" src="<?php echo $urlPrefix, 'dash/', $params['track']; ?>.mpd"></source> <source type="application/dash+xml" src="<?php echo $urlPrefix, 'dash/', $params['track']; ?>.mpd"></source>
</video> </video>