Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $cg_channel = "qiwichupa";
- $tw_channel = "ultimate_game_challenge";
- #
- # GET CYBERGAME JSON
- #
- $cg_url="http://api.cybergame.tv/w/streams2.php?channel=$cg_channel";
- $cg_json = file_get_contents ($cg_url);
- $cg_json_obj = json_decode($cg_json);
- $cg_channel_status = $cg_json_obj->online; #0 - offline, 1 - online
- #
- # GET TWITCH JSON
- #
- $tw_url = "https://api.twitch.tv/kraken/channels/$tw_channel";
- $tw_json = file_get_contents ($tw_url);
- $tw_json_obj = json_decode($tw_json);
- $tw_dash = $tw_json_obj->status;
- #
- # SET CHAT FRAME
- #
- $chat_iframe = <<<HERE
- <div id="chat_wrapper">
- <iframe id="chat_embed" src="http://twitch.tv/chat/embed?channel=$tw_channel&popout_chat=true" style="min-height: 400px; height: 100%; overflow: hidden;"
- height="500" width="300" frameborder="0" scrolling="no"></iframe>
- </div>
- HERE;
- #
- # SET DASH
- #
- $dash = <<<HERE
- <div id="dash">
- $tw_dash
- </div>
- HERE;
- #
- # CHOOSE STREAM FRAME
- #
- if ($cg_channel_status == 0){
- $player_iframe = <<<HERE
- <div id="stream_wrapper">
- <object id="live_embed_player_flash" style='height:100%;width:100%' classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" bgcolor="#000000">
- <param name="allowFullScreen" value="true">
- <param name="allowScriptAccess" value="always">
- <param name="allowNetworking" value="all">
- <param name="flashvars" value="hostname=www.twitch.tv&channel=krakenslair&auto_play=true&start_volume=25">
- <param name="src" value="http://www.twitch.tv/widgets/live_embed_player.swf?channel=$tw_channel">
- <param name="allowfullscreen" value="true">
- <param name="allowscriptaccess" value="always">
- <param name="allownetworking" value="all">
- <embed id="live_embed_player_flash" style='height:100%;width:100%' type="application/x-shockwave-flash" src="http://www.twitch.tv/widgets/live_embed_player.swf?channel=$tw_channel" allowfullscreen="true" allowscriptaccess="always" allownetworking="all" flashvars="hostname=www.twitch.tv&channel=$tw_channel&auto_play=true&start_volume=25" bgcolor="#000000">
- </object>
- </div>
- HERE;
- }else{
- $player_iframe = <<<HERE
- <div id="stream_wrapper">
- <iframe src="http://api.cybergame.tv/p/embed.php?c=$cg_channel&w=100pc&h=100pc&type=embed" width="100%" height="100%" frameborder="0"></iframe>
- </div>
- HERE;
- }
- #
- # SET HEADER
- #
- $header =<<<HERE
- <html>
- <head>
- <style>
- html, body { margin: 0px; padding: 0px; }
- #chat_wrapper {
- position: absolute;
- top: 0px;
- bottom: 0px;
- right: 0px;
- left: auto;
- width: 300px;
- height: 100%;
- overflow: hidden;
- }
- #stream_wrapper {
- height: 100%;
- }
- #dash {
- font-size: 16px;
- background-color: #000000;
- color: #ffffff;
- }
- </style>
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.js?ver=1.8.3"></script>
- <script type="text/javascript">
- function getSize()
- {
- var viewportWidth = document.documentElement.clientWidth, viewportHeight = document.documentElement.clientHeight;
- return [viewportWidth, viewportHeight];
- }
- function resizePlayer()
- {
- jQuery('#stream_wrapper').css({
- 'width': (getSize()[0] - 300) + 'px',
- 'height': getSize()[1] + 'px'
- }
- );
- }
- jQuery(window).load(function(){
- resizePlayer();
- jQuery(window).resize(function() {
- resizePlayer();
- });
- });
- </script>
- <title>
- $tw_dash
- </title>
- </head>
- <body>
- HERE;
- #
- # SER FOOTER
- #
- $footer= <<<HERE
- </body>
- </html>
- HERE;
- #
- # CREATE PAGE
- #
- echo $header;
- #echo $dash;
- echo $chat_iframe;
- echo $player_iframe;
- echo $footer
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement