The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Server.cs 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using Media.Rtsp;
  2. using Media.Rtsp.Server.MediaTypes;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Diagnostics;
  8. using System.Linq;
  9. using System.ServiceProcess;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using Teknik.Areas.Users.Models;
  13. using Teknik.Models;
  14. namespace TeknikStreaming
  15. {
  16. public partial class Server : ServiceBase
  17. {
  18. private RtspServer _RTSPServer;
  19. public Server()
  20. {
  21. InitializeComponent();
  22. }
  23. protected override void OnStart(string[] args)
  24. {
  25. _RTSPServer = new RtspServer(System.Net.Sockets.AddressFamily.NetBios, 555);
  26. LoadStreams();
  27. _RTSPServer.Start();
  28. }
  29. protected override void OnStop()
  30. {
  31. _RTSPServer.Stop();
  32. }
  33. private void LoadStreams()
  34. {
  35. using (TeknikEntities db = new TeknikEntities())
  36. {
  37. List<User> users = db.Users.ToList();
  38. if (users != null)
  39. {
  40. foreach (User user in users)
  41. {
  42. RtspSource source = new RtspSource(string.Format("TeknikLiveStream_{0}", user.Username), string.Format("rtsp://localhost/live/{0}/stream.amp", user.Username));
  43. }
  44. }
  45. }
  46. }
  47. }
  48. }