Twitch API - multiple streams

时间:2015-12-10 13:44:23

标签: php jquery api twitch

So, basically on my website I have multiple streams and I use jquery tabs to have them all on the same page. I embed the twitch channels from their website. Now it's a bit of a mess because it's a lot of code for basically the same embed with just a different channel name, like this:

<div class="embedly-responsive" style="position: relative;padding-bottom: 75.0000%;height: 0;overflow: hidden;">
  <iframe class="embedly-embed" frameborder="0" scrolling="no" allowfullscreen src="//cdn.embedly.com/widgets/media.html?src=%2F%2Fwww-cdn.jtvnw.net%2Fswflibs%2FTwitchPlayer.swff%3Fchannel%3Dcoinlives&fv=hostname%3Dwww.twitch.tv%26start_volume%3D25%26channel%3Dcoinlive%26auto_play%3Dfalse&url=http%3A%2F%2Fwww.twitch.tv%2Fcoinlive&image=http%3A%2F%2Fstatic-cdn.jtvnw.net%2Fjtv_user_pictures%2Fcoinlive-profile_image-7c29302b755258bf-600x600.png&key=0e95bd24acbf43b38a5a3a5558035397&type=application%2Fx-shockwave-flash&schema=twitch" width="400" height="300" style="position: absolute;top: 0;left: 0;width: 100%;height: 100%;"></iframe>
</div>

I used this approach because I don't quite understand how their API works, IDK how to use JSON. Can someone explain to me how I would make this code easier?

0 个答案:

没有答案