79475889

Date: 2025-02-28 14:51:53
Score: 0.5
Natty:
Report link

Well, I have a solution! Joomla rewrites the "src" tag, so I now set it dynamically as follows:

<script>
  
 function loadVideo(videoUrl, videoTitle) {
  const videoDisplay = document.querySelector('.video-display');
  videoDisplay.innerHTML = ''; 

  const videoPlayer = `
    <h3>${videoTitle}</h3>
    <video width="100%" height="auto" controls autoplay>
      <source data-src="${videoUrl}" type="video/mp4">
    </video>
  `;

  videoDisplay.innerHTML = videoPlayer; 

  // Set the actual src dynamically
  const sourceElement = videoDisplay.querySelector('source');
  sourceElement.setAttribute('src', sourceElement.getAttribute('data-src'));
}
</script>
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: v0idation