所以现在我可以从嵌入或 iframe 标签中已嵌入的 soundcloud 文件中获取 url,并在另一个页面上使用这些 url 并将其显示在 fancybox 中。如果用户提供典型的共享 url,例如,有没有办法获得正确的 url 或显示在 fancybox 中http://soundcloud.com/song-b/song-please
or http://snd.sc/yp6VMo
?我尝试查看 api 文档,但找不到我想要的内容。
他试图获取 html 来创建 Soundcloud 小部件,而不是获取曲目的 API url。这o嵌入方法 http://developers.soundcloud.com/docs/oembed“将为指向用户、组、集或播放列表的任何 SoundCloud URL 提供小部件嵌入代码”,建议确保 Soundclouds 更改不会破坏您的应用程序(而不是制作您自己的 Flash 对象或 iframe)。您可以通过 PHP Web 请求来调用它
http://soundcloud.com/oembed?format=js&url=[escaped_url]&iframe=true
或者使用 JSON-P 调用(为了方便使用 jQuery)
$.getJSON('http://soundcloud.com/oembed?callback=?',
{format: 'js', url: 'http://snd.sc/yp6VMo', iframe: true},
function(data) {
// Stick the html content returned in the object into the page
$('#your_player_div').html(data['html'])
}
)
我添加 iframe=true 以便您获得新的 HTML5 播放器,省略获取旧的 Flash 对象。它还适用于您正在使用的 .sc 短网址。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)