问题描述
我的网站使用 LightGallery(https://github.com/sachinchoolur/lightGallery),并且我需要播放一些 Dailymotion 视频.
这个插件在 youtube/vimeo 上运行良好,但我从 Dailymotion 视频中没有得到任何东西.
为了说明这一点,我使用了一个带有此代码的循环作为 dynamicEl:[]
:
{"src":"<?php print 'http://www.dailymotion.com/video/'.$dailymotion['safe_value']; ?>","thumb":"<?php print 'http://www.dailymotion.com/thumbnail/video/'.$dailymotion['safe_value']; ?>"},
与我在 youtube 上使用的代码相同(并且可以正常工作):
{"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'; ?>"},
仅供参考,我有 1.2.0 版
我认为如果您使用原始标记并可以共享 iFrame,您的问题将得到解决,以下是 HTML 的基本结构:
- data-iframe="true" --> 当你想使用 iFrame 时使用它(比如dailymotion提供的)
$videoSRC --> 这个有你视频的 URL --> 要获得它,去 http://www.dailymotion.com/ 选择一个视频,然后单击导出链接以获取 iframe 代码.假设你有这样的事情:
iframe frameborder="0" width="480" height="270" src="//www.dailymotion.com/embed/video/x3ouf29" allowfullscreen
*抱歉,这个 iFrame 代码很乱,我无法在堆栈溢出中编写完整的代码.在我们的示例中复制 src 值:
$videoSRC='http://www.dailymotion.com/embed/video/x3ouf29';
$ThumbnailURL --> 如果您想显示视频链接的缩略图,请在此处输入其 URL.
希望能帮到你,好像有点晚了.
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
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.
这篇关于光画廊 Dailymotion的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!