我正在使用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的Ways?
,或者我必须对响应进行某种弦乐操作,我可以回到400的高度,说300?
谢谢
根据文档,有一个称为maxheight
的URL参数 - 只需将其设置为300:
https://soundcloud.com/oembed?format=json&maxheight=300&url=https://soundcloud.com/giorgiomartini
我建议使用CSS代替使视频iframe响应式,因此无论窗口大小如何,在任何设备上,它总是填充其父容器。请参阅流体宽度视频和VideoWrapper类。