diff --git a/lib/video.php b/lib/video.php index ad14990..059cc9c 100644 --- a/lib/video.php +++ b/lib/video.php @@ -382,6 +382,9 @@ public function generate(): string // Never set src attribute for YouTube/Vimeo - this should be done by JavaScript after consent } else { $code .= " src=\"" . rex_escape($sourceUrl) . "\""; + // Add aria-label for local videos/audio to ensure proper accessibility + $ariaLabel = $this->title ?: $this->getText("a11y_{$mediaType}_player"); + $code .= " aria-label=\"" . rex_escape($ariaLabel) . "\""; } $code .= " crossorigin>"; @@ -389,7 +392,9 @@ public function generate(): string $code .= ""; if (!$isAudio && !empty($this->poster)) { - $code .= "poster['src']) . "\" alt=\"" . rex_escape($this->poster['alt']) . "\">"; + // Use title as fallback alt text if poster alt is empty for accessibility + $posterAlt = !empty($this->poster['alt']) ? $this->poster['alt'] : (!empty($this->title) ? $this->title : $this->getText('a11y_video_poster')); + $code .= "poster['src']) . "\" alt=\"" . rex_escape($posterAlt) . "\">"; } if ($videoInfo['platform'] === 'default') {