Adam
asked on
My Lazyload code seems to only show some thumbnails
I have used the following tutorial and code to implement a youtube lazyload function in my website so that it doesn't take an age for all my YouTube videos to load on my page - Link to tutorial .
I also pasted the full code from the tutorial which I got from here....code used for the tutorial
To tailor it to suit my project, I linked it to my database which has four entries. I replaced the lines:
So it worked (sort of). The connection with the database was fine. The problem is that only the thumbnail for the example - AqcjdkPMPJA seems to appears. For the other three entries in my table, the thumbnail does not appear - although the video plays when I click on it.
I wonder, is it an issue with the tutorial in that only a select few thumbnails work, or could I be appending incorrectly? For example, if I wanted to embed https://www.youtube.com/embed/KmO5J05z3PY?rel=0&showinfo=0, i was putting KmO5J05z3PY in my database table....
Thoughts / advice would be greatly appreaciated. Failing that if anybody can point me in the direction of a simple YouTube Lazloader that works for all thumbnails...
Many thanks
Adam
I also pasted the full code from the tutorial which I got from here....code used for the tutorial
To tailor it to suit my project, I linked it to my database which has four entries. I replaced the lines:
<div class="youtube" data-embed="AqcjdkPMPJA">
<div class="play-button"></div>
with the following -
<?php while($song = mysqli_fetch_array($result))
{ //WE ARE USING A WHILE LOOP TO POPULATE THE TABLE
?>
<div class="youtube" data-embed="<?php echo $song['youtube'];?>">
<div class="play-button"></div>
</div>
<?php } ?>
So it worked (sort of). The connection with the database was fine. The problem is that only the thumbnail for the example - AqcjdkPMPJA seems to appears. For the other three entries in my table, the thumbnail does not appear - although the video plays when I click on it.
I wonder, is it an issue with the tutorial in that only a select few thumbnails work, or could I be appending incorrectly? For example, if I wanted to embed https://www.youtube.com/embed/KmO5J05z3PY?rel=0&showinfo=0, i was putting KmO5J05z3PY in my database table....
Thoughts / advice would be greatly appreaciated. Failing that if anybody can point me in the direction of a simple YouTube Lazloader that works for all thumbnails...
Many thanks
Adam
ASKER
Hi all. Just to update. I'm not sure if a thumbnail was the correct term - I am referring to a preview of the Youtube video. I specified the size in my css / html so it's not really a thumbnail.
Still not found a solution. The preview displays only after the video is completed.
Stuck.
Still not found a solution. The preview displays only after the video is completed.
Stuck.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
No idea why.