问题
I use LightGallery (https://github.com/sachinchoolur/lightGallery) for my website and I need to show some dailymotion videos.
This plugin works fine with youtube/vimeo, but I get nothing from a dailymotion videos.
To show this I use a loop with this code as a dynamicEl:[]
:
{"src":"<?php print 'http://www.dailymotion.com/video/'.$dailymotion['safe_value']; ?>","thumb":"<?php print 'http://www.dailymotion.com/thumbnail/video/'.$dailymotion['safe_value']; ?>"},
Same code as I do with youtube (and it work):
{"src":"<?php print 'http://www.youtube.com/watch?v='.$youtube['safe_value']; ?>","thumb":"<?php print 'http://img.youtube.com/vi/'.$youtube['safe_value'].'/0.jpg'; ?>"},
FYI I have version 1.2.0
回答1:
I think your problem would be solved if you use the original markup with the possibility to share iFrames, Here is the basic structure for your HTML:
<div id="lightgallery" data-iframe="true" data-src="'.$videoSRC.'">
<a href="'.$ThumbnailURL.'">
</div>
- data-iframe="true" --> It is used when you want to use an iFrame(like ones dailymotion provide)
$videoSRC --> This one has your video's URL --> To obtain it, go to http://www.dailymotion.com/ select a video then click on export link to get an iframe code. Suppose you have something like this:
iframe frameborder="0" width="480" height="270" src="//www.dailymotion.com/embed/video/x3ouf29" allowfullscreen
*sorry this iFrame code is messy, I can not pate a full code in stack overflow. copy the src value so in our example:
$videoSRC='http://www.dailymotion.com/embed/video/x3ouf29';
$ThumbnailURL --> if you want to show a thumbnail for your video link, this is the place you enter its URL.
Hope this helps, it seems to be a little bit late.
来源:https://stackoverflow.com/questions/33628205/lightgallery-dailymotion