Skip to content

Commit c877f13

Browse files
authored
Merge pull request #40 from FriendsOfREDAXO/skerbis-patch-external-video-fix
Skerbis patch external video fix
2 parents 6981108 + 8fad8a3 commit c877f13

2 files changed

Lines changed: 20 additions & 6 deletions

File tree

lib/video.php

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ public function generate(): string
378378
if (!$isAudio && $videoInfo['platform'] !== 'default') {
379379
$code .= " data-video-platform=\"" . rex_escape($videoInfo['platform']) . "\" data-video-id=\"" . rex_escape($videoInfo['id']) . "\""
380380
. " aria-label=\"" . rex_escape($this->getText('a11y_video_from')) . " " . rex_escape($videoInfo['platform']) . "\"";
381+
// Never set src attribute for YouTube/Vimeo - this should be done by JavaScript after consent
381382
} else {
382383
$code .= " src=\"" . rex_escape($sourceUrl) . "\"";
383384
}
@@ -439,11 +440,24 @@ public static function parseOembedTags(string $content): string
439440
{
440441
return preg_replace_callback('/<oembed url="(.+?)"><\/oembed>/is', static function ($match) {
441442
$video = new self($match[1]);
442-
$video->setAttributes([
443-
'crossorigin' => '',
444-
'playsinline' => true,
445-
'controls' => true
446-
]);
443+
$videoInfo = self::getVideoInfo($match[1]);
444+
445+
// For YouTube/Vimeo videos, don't use native controls - let Vidstack handle the UI
446+
if ($videoInfo['platform'] === 'youtube' || $videoInfo['platform'] === 'vimeo') {
447+
$video->setAttributes([
448+
'crossorigin' => '',
449+
'playsinline' => true,
450+
'controls' => false // Important: disable native controls for embed videos
451+
]);
452+
} else {
453+
// For regular video files, use native controls
454+
$video->setAttributes([
455+
'crossorigin' => '',
456+
'playsinline' => true,
457+
'controls' => true
458+
]);
459+
}
460+
447461
return $video->generateFull();
448462
}, $content);
449463
}

package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package: vidstack
2-
version: '1.5.0'
2+
version: '1.5.1'
33
author: 'Friends Of REDAXO'
44
supportpage: https://github.com/FriendsOfREDAXO/vidstack
55
requires:

0 commit comments

Comments
 (0)