【发布时间】:2019-02-28 07:59:10
【问题描述】:
我用的是souncloud的oembed端点,默认高度是400,太大了。
我需要调整一下,我试过这个:
https://soundcloud.com/oembed?format=json&height=300&url=https://soundcloud.com/giorgiomartini
但这只会改变艺术品的高度,请注意 html 键(iframe)末尾的高度,在我返回的 json 上:
{
"version": 1,
"type": "rich",
"provider_name": "SoundCloud",
"provider_url": "http://soundcloud.com",
"height": 450,
"width": "100%",
"title": "Giorgio Martini",
"description": null,
"thumbnail_url": "http://i1.sndcdn.com/avatars-000336450748-qnkjy0-t500x500.jpg",
"html": "<iframe width=\"100%\" height=\"450\" scrolling=\"no\" frameborder=\"no\" src=\"https://w.soundcloud.com/player/?visual=true&url=https%3A%2F%2Fapi.soundcloud.com%2Fusers%2F1367858&show_artwork=true&height=300\"></iframe>",
"author_name": "Giorgio Martini",
"author_url": "https://soundcloud.com/giorgiomartini"
}
但我确实需要更改 iframe 本身的高度... oembeed 有办法做到这一点吗?
或者我是否必须对返回的响应进行某种字符串操作以将高度从 400 更改为 300?
谢谢
【问题讨论】:
-
maxheight=300 作为 URL 参数?
-
是的,只是想通了...将其发布为答案并接受它...谢谢! :)
标签: soundcloud oembed