Onebox embedding twitch highlights


(Daytona) #1

Hello!

This topic is for help with embedding a twitch.tv highlight.

I have enabled embedding flash video with onebox and whitelisted the following domains: twitch.tv www.twitch.tv and www-cdn.jtvnw.net

Highlights are not quite as simple to embed as the actual streams. Streams can be embedded by adding /embed to the url like so:
Twitch

For highlights, Twitch tells you to take some html object from the share button and it looks like this:

<object bgcolor="#000000" data="http://www.twitch.tv/swflibs/TwitchPlayer.swf" height="378" id="clip_embed_player_flash" type="application/x-shockwave-flash" width="620"><param name="movie" value="http://www.twitch.tv/swflibs/TwitchPlayer.swf" /><param name="allowScriptAccess" value="always" /><param name="allowNetworking" value="all" /><param name="allowFullScreen" value="true" /><param name="flashvars" value="channel=lumfish&amp;auto_play=false&amp;start_volume=25&amp;videoId=c6492662&amp;device_id=0702ea9cee15a4a4" /></object><br /><a href="http://www.twitch.tv/lumfish" style="padding:2px 0px 4px; display:block; width: 320px; font-weight:normal; font-size:10px; text-decoration:underline;">Watch live video from Lumfish on Twitch</a>

Out of this object, I’ve crafted a url which does successfully contain just the video part of the highlight, but it does not embed magically like youtube videos:

http://www-cdn.jtvnw.net/swflibs/TwitchPlayer.r23a006503a6cde83b2522833c0107f6d01792d94.swf?allowScriptAccess=always&allowNetworking=all&channel=lumfish&auto_play=false&start_volume=25&videoId=c6492662&device_id=86622434ff945128

Can I embed this with the onebox feature of discourse some how? Is there a special onebox syntax to follow?

Thanks for your help and hopefully this helps someone else in the future.

–Daytona


(Jeff Atwood) #2

You would probably need to make a pull request modifying the oneboxer to achieve this.


(Daytona) #3

I’m reading the readme at onebox/README.md at master · discourse/onebox · GitHub

Do you mean to whitelist the URL with Onebox::Engine::WhitelistedGenericOnebox

Or would I have to make a new engine with the 6 step process?


(Jeff Atwood) #4

You can check to see if that page generates sane oEmbed or Open Graph tags via online checkers.


(Marcin Rataj) #5

Iframely URL Debugger - Open Graph, Twitter Cards, oEmbed does not return promising results:

I just checked http://www.twitch.tv/lumfish/c/6492662 and both OpenGraph and oEmbed return an autoplay of http://www.twitch.tv/lumfish/embed, which is clearly a bug on twitch side (we want embed of a specific recording).

I guess it could be fixed by creating custom onebox that replaces http://www.twitch.tv/<user>/c/<video_id> with code from share button.


(Kane York) #6

I think that a new engine is required to fix the VOD links.