Last active
December 16, 2015 08:49
-
-
Save Torthu/5408382 to your computer and use it in GitHub Desktop.
Twitch.tv dualstream
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| body { | |
| margin:0; | |
| padding:0; | |
| } | |
| .half-width { | |
| width: 50%; | |
| height: 100%; | |
| float:left; | |
| box-sizing:border-box; | |
| padding-right: 1px; | |
| } | |
| .streamer { | |
| background: #BDA1EC; | |
| color: #fff; | |
| text-transform:uppercase; | |
| height: 20px; | |
| padding: 10px; | |
| text-align:center; | |
| } | |
| .flash-player { | |
| width: 100%; | |
| height: 50%; | |
| padding:0; | |
| margin:0; | |
| border:0; | |
| height: calc(100% - 460px); | |
| display: block; | |
| } | |
| .chat { | |
| width: 100%; | |
| height: 400px; | |
| border:0; | |
| padding:0; | |
| margin:0; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Takes in two stream names from Twitch.tv and opens stream + chat | |
| // e.g index.html?stream1=polt&stream2=dragon | |
| function getURLParameter(name) { | |
| return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null; | |
| } | |
| function addStream(streamName) { | |
| var appendCode = '' + | |
| '<div class="half-width">' + | |
| '<object type="application/x-shockwave-flash" class="flash-player" data="http://www.twitch.tv/widgets/live_embed_player.swf?channel=' + streamName + '&bgcolor=#000000">' + + | |
| '<param name="movie" value="http://www.twitch.tv/widgets/live_embed_player.swf" />' + | |
| '<param name="flashvars" value="hostname=www.twitch.tv&channel=' + streamName + '&auto_play=true&start_volume=25" />' + | |
| '</object>' + | |
| '<div class="streamer">' + streamName + '</div>' + | |
| '<iframe scrolling="no" class="chat" src="http://www.twitch.tv/chat/embed?channel=' + streamName + '&popout_chat=true">' + | |
| '</iframe>' + | |
| '</div>'; | |
| $('body').append(appendCode); | |
| } | |
| $(document).ready(function () { | |
| addStream(getURLParameter('stream1')); | |
| addStream(getURLParameter('stream2')); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> | |
| <link rel="stylesheet" type="text/css" href="ds.css" /> | |
| <script src="ds.js"></script> | |
| </head> | |
| <body> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment