Twitch.tv embed is not working correctly


(Jacob Chapel) #1

I am not sure why this is causing problems, but when I try to embed a Twitch.tv stream (just by linking it) the url is messed up in the iframe causing it to load a page from my domain and 404.

Here is what happens:


(Jacob Chapel) #2

Note above, the iframe src link is

https://meta.discourse.org/t/twitch-tv-embed-is-not-working-correctly/http:www-cdn.jtvnw.net/swflibs/TwitchPlayer.swf?channel=goldenboyftw&playerType=facebook

(Jeff Atwood) #3

Interesting, @techapj can you have a look?


(Arpit Jalan) #4

Okay, I looked into it, and it seems like Twitch recently broke the Video URL they provide via Open Graph:

<meta content='http:www-cdn.jtvnw.net/swflibs/TwitchPlayer.swf?channel=leko92&playerType=facebook' property='og:video'>
<meta content='https:www-cdn.jtvnw.net/swflibs/TwitchPlayer.swf?channel=leko92&playerType=facebook' property='og:video:secure_url'>

Notice http:www-cdn.jtvnw.net, instead it should be http://www-cdn.jtvnw.net.

I’ll try to communicate this to Twitch Developers.


#5

Don’t you love it when it’s not your fault!

:slight_smile:


(Jacob Chapel) #6

Odd, when I went to check myself, it was properly formatted.

Okay, so when going to http://www.twitch.tv/leko92 the video urls are formatted properly.

When going to http://www.twitch.tv/leko92/embed it shows the above.

What is causing it to use the embed url, I don’t see anything in onebox specific to Twitch.


(Arpit Jalan) #7

Onebox uses Open Graph protocol to embed Twitch video stream. When you will view page source for http://www.twitch.tv/leko92, you will see:

<meta content='video.other' property='og:type'>
<meta content='http:www-cdn.jtvnw.net/swflibs/TwitchPlayer.swf?channel=leko92&playerType=facebook' property='og:video'>
<meta content='https:www-cdn.jtvnw.net/swflibs/TwitchPlayer.swf?channel=leko92&playerType=facebook' property='og:video:secure_url'>
<meta content='application/x-shockwave-flash' property='og:video:type'>

Onebox will detect that it has to embed video, by seeing property og:type which has content video:other. Then it will look for video url in property og:video which has content http:www-cdn.jtvnw.net/swflibs/TwitchPlayer.swf?channel=leko92&playerType=facebook.

Now since the video url is broken, the Onebox embed is creating trouble.

Hope, this makes clear how Twitch embed works. :slight_smile:


(Jacob Chapel) #8

I understand how it works. My point is if you go to the base user page, without /embed, the og:video links are correct and have the // as they should.

This is definitely a Twitch.tv issue, but its not always showing the incorrect meta tags.


(Arpit Jalan) #9

Weird, when I view source for base user page (without /embed), it has broken og:video links:


(Jeff Atwood) #10

Did Twitch fix this?


(Arpit Jalan) #11

Not yet, just created a new issue for this:

https://github.com/justintv/Twitch-API/issues/259?1


(Arpit Jalan) #12

Twitch.tv fixed the issue! :smile:

http://try.discourse.org/t/twitch-tv-onebox/323


(Arpit Jalan) #13