Simplify Video.js setup

This commit is contained in:
Vencislav Atanasov 2024-10-31 22:13:44 +02:00
parent 9fc93ec924
commit 7c7661f8b4
1 changed files with 1 additions and 5 deletions

View File

@ -208,10 +208,6 @@ 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');
$vjsConfig = htmlspecialchars(json_encode([
'fluid' => true,
]));
$params = array_merge([ $params = array_merge([
'host' => 'stream.openfest.org', 'host' => 'stream.openfest.org',
'track' => 'hall-a', 'track' => 'hall-a',
@ -220,7 +216,7 @@ function stream_player_shortcode($params = []) {
$urlPrefix = 'https://' . $params['host'] . '/'; $urlPrefix = 'https://' . $params['host'] . '/';
return <<<EOF return <<<EOF
<video class="video-js vjs-fill" controls data-setup="{$vjsConfig}"> <video class="video-js vjs-fluid" controls data-setup="{}">
<source type="application/x-mpegURL" src="{$urlPrefix}hls/{$params['track']}.m3u8"></source> <source type="application/x-mpegURL" src="{$urlPrefix}hls/{$params['track']}.m3u8"></source>
<source type="application/dash+xml" src="{$urlPrefix}dash/{$params['track']}.mpd"></source> <source type="application/dash+xml" src="{$urlPrefix}dash/{$params['track']}.mpd"></source>
</video> </video>