Skip to content

Commit

Permalink
also support short urls
Browse files Browse the repository at this point in the history
  • Loading branch information
rajbos committed Aug 14, 2024
1 parent 00f16e4 commit 1e318cd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ <h1 id="feature-title">Feature Title</h1>
if (videoDetails) {
document.getElementById('feature-title').textContent = videoDetails.title;
if (videoDetails.videoUrl) {
document.getElementById('feature-video').src = videoDetails.videoUrl.replace("youtube.com", "youtube.com/embed");
let videoUrl = videoDetails.videoUrl;
if (videoUrl.includes("youtube.com")) {
videoUrl = videoUrl.replace("youtube.com", "youtube.com/embed");
} else if (videoUrl.includes("youtu.be")) {
videoUrl = videoUrl.replace("youtu.be", "youtube.com/embed");
}
document.getElementById('feature-video').src = videoUrl;
document.getElementById('feature-video').style.display = 'block';
document.getElementById('coming-soon').style.display = 'none';
} else {
Expand Down

0 comments on commit 1e318cd

Please sign in to comment.