1
0
mirror of https://git.teknik.io/Teknikode/Teknik.git synced 2023-08-02 14:16:22 +02:00
Teknik/TeknikStreaming/Server.cs
Uncled1023 e163e0ca8c - Moved TeknikEntities from global field to disposed local instances.
- Added additional logging/handling of errors.
- Added processed/total bytes for uploads, downloads, and encryption/decryption.
- Fixed paste CSS bundle using a script handler.
- Fixed bad js when viewing a vault
2017-04-08 21:01:31 -07:00

57 lines
1.4 KiB
C#

using Media.Rtsp;
using Media.Rtsp.Server.MediaTypes;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
using Teknik.Areas.Users.Models;
using Teknik.Models;
namespace TeknikStreaming
{
public partial class Server : ServiceBase
{
private RtspServer _RTSPServer;
public Server()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
_RTSPServer = new RtspServer(System.Net.Sockets.AddressFamily.NetBios, 555);
LoadStreams();
_RTSPServer.Start();
}
protected override void OnStop()
{
_RTSPServer.Stop();
}
private void LoadStreams()
{
using (TeknikEntities db = new TeknikEntities())
{
List<User> users = db.Users.ToList();
if (users != null)
{
foreach (User user in users)
{
RtspSource source = new RtspSource(string.Format("TeknikLiveStream_{0}", user.Username), string.Format("rtsp://localhost/live/{0}/stream.amp", user.Username));
}
}
}
}
}
}