Link to home
Start Free TrialLog in
Avatar of Adam
AdamFlag for United Kingdom of Great Britain and Northern Ireland

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:
<div class="youtube" data-embed="AqcjdkPMPJA">
		<div class="play-button"></div>

Open in new window

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 } ?>

Open in new window


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
Avatar of Adam
Adam
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Further to this. I have tried a different LazyLoad script and I'm getting the same issue. The Thumbnail preview of the video only seems to work for some of the videos, not all.

No idea why.
Avatar of 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.
ASKER CERTIFIED SOLUTION
Avatar of Adam
Adam
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial