How to Play A Random Video from A Folder Using Streamer.Bot (Websocket v5.x)

Channel:
Subscribers:
919
Published on ● Video Link: https://www.youtube.com/watch?v=2JVCMuLH1P8



Duration: 4:16
745 views
52


For all you cool cats out there trying to set up one media source and have all of your videos pulled through it, run your own randomized ads, or do any other type of stuff using the Random Video from Folder action but couldn't get it to work since the updates to websockets (yea, a lot of people don't even realize that is why it doesn't work anymore) I have completely rebuilt the action for use with current v5.x websockets. So here you go, enjoy.

- - - C# CODE (copy and paste this into execute C# code sub-action) - - -
using System;
using System.IO;

public class CPHInline
{
public bool Execute()
{
var rand = new Random();
var myDirectory = args["videoFolder"].ToString();
var files = Directory.GetFiles(myDirectory,"*.*");
var myfile = files[rand.Next(files.Length)];

CPH.SetArgument("randomVideo", myfile);

return true;
}
}

- - - OBS RAW CODE (copy and paste this into OBS RAW sub-action) - - -
{
"requestType": "SetInputSettings",
"requestData": {
"inputName": "Pop Up Video Pull",
"inputSettings": {
"local_file": "%randomVideo%"
},
"overlay": true
}
}

Thank you for watching! Hope you found this video helpful and I hope you stick around for more videos.

Come catch a live stream sometime!
@http://www.twitch.tv/geefbird