Gallery:模块:embedvideo

来自站长百科
跳转至: 导航、​ 搜索

嵌入视频(Embed Video)模块[ ]

描述[ ]

该简单的模块允许你嵌入youtube和google视频,或通过所有相册的"Add Items"移除.flv视频文件。


总览[ ]

我曾一度需要与家人和各地的朋友分享家庭视频剪辑。我没有足够的流量来将家中gallery2服务器上的这些视频直接拿出来。唯一的办法就是在外部网站中托管我的家庭视频并将它们作为项目直接嵌入到gallery相册页面中去。有些帖子谈到了该操作的具体实行方法,牵涉到直接将嵌入的视频播放器代码粘贴到某gallery相册项目的描述中去。这操作起来可是很费神的,因此我希望能找到更快更自动化的方法来进行类似的视频内容添加。该模块正好解了我的燃眉之急。


解析[ ]

该模块扩展了ItemAddPlugin。作为输入方式,它将Gallery "Add Items"中的URL用于youtube,googlevideo或远程.flv文件,并在该URL对应的gallery项目中添加嵌入的视频对象。它使用youtube API 来抽取标题,描述以及youtube视频URL的缩略图。它还解析google视频页面的raw HTML(因为不存在google视频API)以获取相同的URL信息。


外部依赖性/需要打补丁[ ]

无需额外的外部PHP库依赖或.ini更改,且无该模块的下层Gallery2框架正常运作所需的直接补丁,如果你想在项目添加到相册之后进行编辑的话,这里倒是有1个例外的补丁。因为该模块仍"通过gallery相片项目描述字段中的html进行视频的嵌入",这里有一个补丁,如果你想在项目添加到相册之后进行编辑的话,就应当打上modules/core/classes/GalleryUtilities.class。如果你不想在项目添加到相册之后进行编辑的话,就无需打这个补丁了。如果没有打上该补丁的话,项目编辑过程将会移除描述字段中嵌入的markup。而你的网站没有被配置为允许描述字段中的rawHTML。该gallery论坛[1] 帖子提到了该补丁,包含以下步骤:

1) 注释掉modules/core/classes/GalleryUtilities.class 中的第859行为: /* $html = $parser->parse($html); */

2) 确保"站点管理(Site Admin) -> 一般(General) -> 嵌入的Markup(Embedded Markup)"设定为"Raw HTML"了。

对于2.2.4及较新版本的gallery2,有报告称应作出这些修改以使视频嵌入能够正常进行(不仅仅是较早版本gallery中的编辑或更新操作)。

EmbedVideo模块也依赖"Thumbnail Manager"模块的默认缩略图,以用于可被添加到站点中的远程.flv或.swf文件。如果你没有安装该模块,就有必要为某有效缩略图定义有效的URL,这可以通过设定模块中的flvThumbnail变量来完成。


看看实际使用如何[ ]

http://www.pippins.net/gallery2/v/development/


安装[ ]

  • 下载Embedvideo.zip[2]
  • 解压到Gallery2模块目录。
  • 在站点管理(Site Admin) -> 插件(Plugins)页面中进行安装和激活。
  • 要进行更新的话请遵照上面给出的步骤进行操作,点击插件页面上的upgrade。


用法[ ]

  • 安装并激活该模块。
  • 站点管理(Site admin) -> 导入(Import),这里会出现新的Embed Video条目。
  • 如果你要嵌入youtube URL的话,就设定youtubeDevId。
  • 在所有相册中,你都可以点击"Add Items"并看到新标签"Embed Video"。
  • 输入希望嵌入的视频URL。


支持的视频站点/文件类型[ ]

  • 视频站点:
    • YouTube:http://www.youtube.com/watch?v=xxxxxxxxxxx
    • GoogleVideo: http://video.google.com/videoplay?docid=xxxxxxxxxxx
    • YahooVideo: http://video.yahoo.com/video/play?vid=xxxxxx
    • Metacafe: http://www.metacafe.com/watch/xxxxxx/xxxxxx
    • Revver: http://www.revver.com/watch/xxxxxx
    • Dailymotion: http://www.dailymotion.com/video/xxxxxxxxxxx
    • Divshare: http://www.divshare.com/download/xxxxxxxxx
    • Stickam: http://www.stickham.com/editMediaComment.do?method=load&mId=xxxxxxxxx
    • Myspace1: http://vids.myspace.com/index.cfm?fuseaction=vids.individual&VideoID=xxxxxxxx
    • Myspace2: http://myspacetv.com/index.cfm?fuseaction=vids.individual&videoid=xxxxxxxx
    • Vimeo: http://www.vimeo.com/xxxxxx
    • Generic: Any webpage with an '<object ... <embed ...' style video on its page
  • 文件类型:
    • FlashVideo (.flv): http://*/*.flv
    • FlashVideo (.swf): http://*/*.swf

如果不能运行或是发生错误该怎么办?[ ]

Despite my best efforts to create bug free code, you may come across something that doesn't quite work right. If you can't get the module to work as advertised, or get an error you don't understand, the module has a built in debug mode that can help. Under your site admin, click on the "Embed Video" link, and add a parameter called "debugOutput" and set it to "true". Proceed to add the video URL that is giving you the trouble. The resulting webpage will be full of debug information about the process it underwent to add your video. Right click on the webpage that is shown in this debug mode, and save it as a local .html file on your system. Next, add it as a file attachment in a post you make to the message forum[3]. I will look at your attached html file, and get back to you with any insight I may have.


需要进一步调整的代码/已知问题/Bug[ ]

  • 被嵌入的远程.flv文件URL没有缩略图。
  • 无法抑制video.yahoo.com 嵌入视频的自动播放机制。
  • 无法抽取google video嵌入视频的描述。


弊端/劣势[ ]

  • 需要给GalleryUtilities.class打补丁才能对这些项目进行编辑
  • 要对具raw HTML格式的相片项目描述字段进行过载操作才能够让一切都有序进行


被请求的特点[ ]

  • 停止继续使用某相片对象中的描述字段进行视频的嵌入。新建GalleryEmbeddedItem对象,这自动允许这些对象存在于gallery中。
  • 为Add Embed Video 页面添加特点以允许指定youtube userID,为该用户取得所有对应视频,并将这些视频列在页面中,包括各自的标题和缩略图。允许Add Embed Video过程添加多个视频至Gallery2。
  • 为youtube播放列表的嵌入给予支持(如http://uk.youtube.com/p/2D133BCB977E1A97)。在此也有提及:http://www.google.com/support/youtube/bin/answer.py?hl=th&answer=70458


修订历史[ ]

2007-06-12 - 1.0.0 – 首次发布

2007-06-23 - 1.0.1 –Fixed bug related to override parameters not trumping default parameters & youtube URL match being too restrictive.

2007-06-28 - 1.0.2 – 添加了远程文件"不存在检查"。google video标题解析bug被修复。添加了对metacafe.com和video.yahoo.com的支持。添加了新的useRemoteSize和autoStart参量。

2007-07-01 - 1.0.3 – 添加了远程视频服务器缩略图的重设尺寸能力。

2007-07-09 - 1.0.4 - google video尺寸问题被解决,更完善的debug输出。

2007-08-30 - 1.0.5 – 添加了对.swf文件类型的支持。添加了参量以控制youtube嵌入相关视频的启用和禁用。更完善的缩略图尺寸设定逻辑。

2007-10-31 - 1.0.6 – 添加了嵌入视频的缩略图水印效果的支持。

2007-11-17 - 1.0.7 - Added support for adding revver, dailymotion, and divshare embedded videos. Added support for adding youtube embedded videos without a youtube developer ID. Fixed default watermark alignment.

2007-11-28 - 1.0.8 – 添加了对StickAm和Myspace嵌入视频的支持。新添加了摘要和描述的wordwrap参量。

2008-04-17 - 1.0.9 - Added support for high quality youtube video urls. Updated dailymotion parsing algorithms. Added support for adding vimeo.com videos. Added support for new youtube API (GDATA) and deprecated youtubeDevId entry.

2008-05-28 - 1.1.0 - google video缩略图解析算法被修正。添加了对一般站点嵌入视频内容的支持。