Extreme Streaming: Diving into JavaScript Concepts

Welcome back, streamers! This week we’re diving into some extreme streaming concepts with XSplit, which includes something you may have never seen before. A large advantage with XSplit over OBS is the developer community and the JavaScript extensions you can use to create some never-before-seen stuff. These streaming concepts may take a lot of learning up-front in order to understand them fully, but we are entirely okay with sharing a few secrets in order to develop something that really shines. Here’s a small snippet of powerful code below:

// List of words to loop on
var words = ['awesome','incredible','whatever'];

// Index of the words array
var index = 0;

window.setInterval(function(){
 SetText(words[index]);
 // Increment the index modulo the length of words: 0, 1, 2, 0, 1, 2, etc
 index = (index+1) % words.length;
}, 1000);

This creates a dynamic text field in your viewport and you can set it to whatever words you like. In this example above, the text field will alter between the word “awesome, incredible, whatever” at a speed of a thousand milliseconds (or, one second). How is it that you set this text field?

This is considered "extreme streaming" since it's using javascript now.

This is considered “extreme streaming” since it’s using javascript now.

Click Add Text Source in the source menu, then check the Use Custom Script checkbox. That should give you the bottom half of the image above. Paste the javascript into the Script tab field, adjust what words you want to use, and then use the text source how you want!

The real power of XSplit comes when you’re able to use JavaScript code to develop your own XSplit plugins that aren’t available through Split Media Labs! This kind of extreme streaming knowledge isn’t very common among content producers, so this should provide you an edge with content creation. Now get out there and stream away!