Youtube OEmbed 宽度不能大于 740px?
我正在尝试使用 Youtube 的 oEmbed 功能 将视频嵌入到960x580,但由于某种原因,它似乎达到了 740 的最大值。请参见下文:
请求:
http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch%3Fv%3DbDOYN-6gdRE&format=json&maxwidth=960&maxheight=580
响应:
{
"provider_url": "http:\/\/www.youtube.com\/",
"title": "1 of 4 Dr. Bill Lands on Cardiovascular Disease: Omega-6 displaces Omega-3",
"html": "\u003cobject width=\"740\" height=\"580\"\u003e\u003cparam name=\"movie\" value=\"http:\/\/www.youtube.com\/v\/dgU3cNppzO0?version=3\"\u003e\u003c\/param\u003e\u003cparam name=\"allowFullScreen\" value=\"true\"\u003e\u003c\/param\u003e\u003cparam name=\"allowscriptaccess\" value=\"always\"\u003e\u003c\/param\u003e\u003cembed src=\"http:\/\/www.youtube.com\/v\/dgU3cNppzO0?version=3\" type=\"application\/x-shockwave-flash\" width=\"740\" height=\"580\" allowscriptaccess=\"always\" allowfullscreen=\"true\"\u003e\u003c\/embed\u003e\u003c\/object\u003e",
"author_name": "LatestNutrition",
"height": 580,
"thumbnail_width": 480,
"width": 740,
"version": "1.0",
"author_url": "http:\/\/www.youtube.com\/user\/LatestNutrition",
"provider_name": "YouTube",
"thumbnail_url": "http:\/\/i1.ytimg.com\/vi\/dgU3cNppzO0\/hqdefault.jpg",
"type": "video",
"thumbnail_height": 360
}
我什至尝试过使用 width
和除了 maxwidth
和 maxheight
之外,还用 height
参数代替 / ,但我似乎仍然无法让它大于 740。
有吗有什么方法可以解决这个问题,以便我可以获得我需要的尺寸的嵌入式视频?
I'm trying to use Youtube's oEmbed functionality to get a video embed at 960x580, but for some reason it seems to be maxing out at 740. Please see below:
Request:
http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch%3Fv%3DbDOYN-6gdRE&format=json&maxwidth=960&maxheight=580
Response:
{
"provider_url": "http:\/\/www.youtube.com\/",
"title": "1 of 4 Dr. Bill Lands on Cardiovascular Disease: Omega-6 displaces Omega-3",
"html": "\u003cobject width=\"740\" height=\"580\"\u003e\u003cparam name=\"movie\" value=\"http:\/\/www.youtube.com\/v\/dgU3cNppzO0?version=3\"\u003e\u003c\/param\u003e\u003cparam name=\"allowFullScreen\" value=\"true\"\u003e\u003c\/param\u003e\u003cparam name=\"allowscriptaccess\" value=\"always\"\u003e\u003c\/param\u003e\u003cembed src=\"http:\/\/www.youtube.com\/v\/dgU3cNppzO0?version=3\" type=\"application\/x-shockwave-flash\" width=\"740\" height=\"580\" allowscriptaccess=\"always\" allowfullscreen=\"true\"\u003e\u003c\/embed\u003e\u003c\/object\u003e",
"author_name": "LatestNutrition",
"height": 580,
"thumbnail_width": 480,
"width": 740,
"version": "1.0",
"author_url": "http:\/\/www.youtube.com\/user\/LatestNutrition",
"provider_name": "YouTube",
"thumbnail_url": "http:\/\/i1.ytimg.com\/vi\/dgU3cNppzO0\/hqdefault.jpg",
"type": "video",
"thumbnail_height": 360
}
I've even tried using width
and height
parameters in place of / in addition to maxwidth
and maxheight
, but I still can't seem to get it larger than 740.
Is there any way to get around this so I can get an embedded video at the dimensions I need them at?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我无法在此处粘贴我的代码,
我已使用此代码使用自定义字段在 WordPress 中插入 YouTube 视频...
我需要插入与原始大小不同的视频。在这里您需要定义您的 youtube ID 和所需的宽度
我在末尾添加了一些 youtube 插入选项
http://pastebin.com /KRwvSzqP
I could'nt paste my code here,
I've used this code for inserting youtube videos in wordpress using custom fields...
I needed to insert videos in a different size from the original. here you need to define your youtube ID and desired Width
I've added some youtube insert options at the end
http://pastebin.com/KRwvSzqP
我已经找到了一种解决方法,它并不像我希望的那样漂亮,但它有效:
但是,如果有人可以提出更优雅的解决方案,我会非常高兴听到它。
I've figured out a workaround, which isn't as pretty as I'd like it to be, but it works:
However, if anyone can suggest a more elegant solution, I'd be more than happy to hear it.
Embedly 最近添加了一种指定嵌入宽度的方法。它会为您处理缩放问题。只需将
width=960
添加到您的请求中即可。Embedly recently added a way to specify the
width
of the embed. It will take care of the scaling for you. Just addwidth=960
to your request.这是一个老问题,但我想无论如何我都会贡献我的发现...
默认情况下,我的 Youtube 文件以 640 宽度嵌入,这比我的 615 内容宽度大。
我将以下内容添加到我的functions.php 文件中:
起初这仍然不起作用,直到我停用 Jetpack 插件中的嵌入功能。希望这对其他人有帮助。
this is an old question but thought I'd contribute my findings anyway...
By default, my Youtube files were getting embedded at a 640 width which was bigger than my 615 content width.
I added the following to my functions.php file:
At first this still didn't work, until I deactivated the embed feature in the Jetpack plugin. Hope this helps someone else.