我正在尝试使用Vimeo视频,但视频仍然只是黑屏。有什么问题?
<video src="//player.vimeo.com/video/20802032?title=0&byline=0&portrait=0&color=990033" width="960" height="540" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></video>
谢谢。
答案 0 :(得分: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,以及许多其他有用的信息。
答案 1 :(得分:0)
您需要使用iframe
代替。
演示here
小提琴的例子:
<iframe src="//player.vimeo.com/video/20802032?title=0&byline=0&portrait=0&color=990033" width="960" height="540" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>