2014-01-30 208 views
-1

我正在尝试使Vimeo视频工作,但视频仍然只是黑屏。哪里不对?Vimeo视频不起作用

<video src="//player.vimeo.com/video/20802032?title=0&amp;byline=0&amp;portrait=0&amp;color=990033" width="960" height="540" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></video> 

谢谢。

+2

什么_you_做错了就是把这个URL放在一个'video'元素中...... URL提供了一个完整的HTML文档,所以嵌入它使用一个'iframe'。 – CBroe

+0

好吧,但iframe也不起作用... @CBroe – Caspert

回答

0

您需要改为使用iframe

演示here

从小提琴例:

<iframe src="//player.vimeo.com/video/20802032?title=0&amp;byline=0&amp;portrait=0&amp;color=990033" width="960" height="540" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> 
2

正如其他人所说,你应该使用嵌入的iframe,而不是当前的尝试。 Vimeo为您拥有或以其他方式能够(允许)嵌入的每个视频提供此代码。

获得正确嵌入代码的另一种方法是使用它们的端点oEmbed。例如,这JSON是为您的视频检索:

http://vimeo.com/api/oembed.json?url=http%3A//vimeo.com/20802032

万一你不小心点击,这里是什么在该网址提供:

{ 
    "type":"video", 
    "version":"1.0", 
    "provider_name":"Vimeo", 
    "provider_url":"https:\/\/vimeo.com\/", 
    "title":"Motion Graphics Reel 2011", 
    "author_name":"timurfrost", 
    "author_url":"http:\/\/vimeo.com\/timurfrost", 
    "is_plus":"1", 
    "html":"<iframe src=\"\/\/player.vimeo.com\/video\/20802032\" width=\"1280\" height=\"720\" frameborder=\"0\" title=\"Motion Graphics Reel 2011\" webkitallowfullscreen mozallowfullscreen allowfullscreen><\/iframe>", 
    "width":1280, 
    "height":720, 
    "duration":78, 
    "description":"Motion Graphics Reel by Timur Frost", 
    "thumbnail_url":"http:\/\/b.vimeocdn.com\/ts\/161\/363\/161363406_1280.jpg", 
    "thumbnail_width":1280, 
    "thumbnail_height":720, 
    "video_id":20802032 
} 

正如你看到的,没有理由猜测嵌入视频的正确方法。仅使用视频网址和此数据服务的知识,您可以提交http请求并检索官方认可的嵌入html以及其他一些有用信息。