How is SoundCloud embedding an HTML5/JS widget on Facebook?

时光毁灭记忆、已成空白 提交于 2019-12-17 22:32:25

问题


Here's the scenario I'm seeing -

  • You click to post a sound from SoundCloud to Facebook
  • It embeds a player in the post that can either be clicked on to take you to the original item on SoundCloud OR you can click a Play icon to play the sound right in your feed.
  • The player is a Javascript/HTML5 player (which you can see by viewing source) HOWEVER if you take the embedded URL and put it in the Facebook open graph debugger you'll see that it appears to be directing to embed a Flash SWF

How is SoundCloud doing, what appears to be, some kind of redirect trick to get a "og:video" SWF to turn into a JS/HTML5 player?

I notice that there is an "og:type" of "soundcloud:sound" so is it some kind of whitelist/Facebook application scenario?

Try it yourself with this:

  • OG debug: https://developers.facebook.com/tools/debug/og/object?q=https%3A%2F%2Fsoundcloud.com%2Fsystek_music%2Fcyberoptics-sub-antix-the%3Futm_source%3Dsoundcloud%26utm_campaign%3Dshare%26utm_medium%3Dfacebook

I did find this bit of info from the SoundCloud site about how they've switched to JS players (that fall back to Flash on older browsers): http://help.soundcloud.com/customer/portal/articles/1219149-where-has-the-flash-widget-gone-


回答1:


This may only be a partial answer. But there exists a special Facebook Open Graph Music program which "is only available to whitelisted partners at this time". This includes a bridge which has the goal to "enable play buttons on feed stories on Facebook.com that can play and pause tracks and indicate which is playing."

However, apparently you can include both Flash (application/x-shockwave-flash) and HTML5 video (video/mp4) formats in the og:video:type property.



来源:https://stackoverflow.com/questions/22751484/how-is-soundcloud-embedding-an-html5-js-widget-on-facebook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!