IP.Board Tutorials

Twitch Block for IPB4

Submitted by Mr_Joker, , Thread ID: 4473

Thread Closed
Mr_Joker
YouR JuSt G4Y
Level:
0
Reputation:
3
Posts:
795
Likes:
51
Credits:
493
02-06-2015, 04:01 PM
This post was last modified: 02-06-2015, 04:02 PM by Mr_Joker
#1
You will need to create PHP block under Pages and use the following code.
Code:
function is_channel_live($channel)
{
$request = json_decode( @file_get_contents( 'https://api.twitch.tv/kraken/streams/' . $channel ) );
return ( ! is_null( $request->stream ) ) ? TRUE : FALSE;
}
$chan = "twitch";
if (is_channel_live($chan)==true)
echo "
<h3 class='ipsType_reset ipsWidget_title'>Live Stream (Online)</h3>
<div class='embed-container'>
<iframe src='http://www.twitch.tv/' . $chan . '/embed' frameborder='0'></iframe>
</div>";

else
echo "
<h3 class='ipsType_reset ipsWidget_title'>Live Stream (Offline)</h3>
<div class='embed-container'>
<font color=red><b>Offline</b></font>
</div>";

RE: Twitch Block for IPB4

zardkim
Newbie
Level:
0
Reputation:
0
Posts:
14
Likes:
0
Credits:
15
03-06-2015, 05:14 AM
#2
wow~!
good tut~! thsnks Mr_Jocker

Users browsing this thread: 1 Guest(s)