We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 7e903b1 + f6fa064 commit ed41004Copy full SHA for ed41004
widget/services.js
@@ -608,13 +608,21 @@
608
title="${item.title}"
609
></video>`;
610
611
- vidPlayer = videojs(videoId, {
+ // Detect if the video is a YouTube URL
612
+ const isYouTube = /^(?:https?:\/\/)?(?:www\.)?(youtube\.com|youtu\.be)(\/|$)/i.test(item.videoUrl);
613
+ const videoJsOptions = {
614
muted: false,
615
playsinline: true,
- controls: true,
616
+ controls: !isYouTube,
617
techOrder: ["html5", "youtube", "vimeo"],
- enableDocumentPictureInPicture: true,
- });
618
+ enableDocumentPictureInPicture: true
619
+ };
620
+ if (isYouTube) {
621
+ videoJsOptions.youtube = {
622
+ ytControls: 1,
623
624
+ }
625
+ vidPlayer = videojs(videoId, videoJsOptions);
626
627
addNextPreviousButtons();
628
addOverlayPlayButton();
0 commit comments