Skip to content

Instantly share code, notes, and snippets.

@DevJohnC
Created March 25, 2014 04:52
Show Gist options
  • Select an option

  • Save DevJohnC/9755437 to your computer and use it in GitHub Desktop.

Select an option

Save DevJohnC/9755437 to your computer and use it in GitHub Desktop.
AdjutantOS YouTube Stream Testing App
using System;
using FragLabs.AdjutantOS.API.Apps;
using FragLabs.AdjutantOS.API;
using FragLabs.AdjutantOS.API.Modules.Domains;
using FragLabs.AdjutantOS.API.Assets;
using FragLabs.AdjutantOS.Apps.Video.Dtos;
using Environment = FragLabs.AdjutantOS.API.Environment;
namespace FragLabs.AdjutantOS.Apps.Video
{
[AppManifest("Video","3dd99f32-f2e0-44ad-a271-b01c31dd53a1","1.0","John Carruthers","johnc@frag-labs.com","http://adjutantos.com/","Video playback app")]
public class VideoApp : AppBase
{
const string ConfigName = "videoapp_config";
public static VideoApp Instance { get; private set; }
/// <summary>
/// Gets the config.
/// </summary>
/// <value>The config.</value>
public VideoConfig Config { get; private set; }
public VideoApp ()
{
Instance = this;
Config = Options.Load<VideoConfig>(ConfigName);
if (Config == null)
{
Config = new VideoConfig();
Options.Save(ConfigName, Config);
}
}
public override void Start ()
{
base.Start ();
Environment.ClientConnected += new DomainAction<object, ComputerEventArgs>((sender, args) => {
var ytdl = new Streams.YoutubeDL("https://www.youtube.com/watch?v=-O9ftz8g0cE");
var server = new TcpStreamServer(System.Net.IPAddress.Any, ytdl.GetStream(), false);
ServiceInvoker.CallOneWay(args.Computer, new PlayStream {
AssetUrl = server.Url,
Filename = "Youtube Stream",
Filesize = -1
});
}).Callback;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment