Ejemplo n.º 1
0
        public LivingStream GetLivingStream(string streamName)
        {
            if (publisherSessionService == null && serverTask != null)
            {
                var type            = options.GetType();
                var proInfo         = type.GetProperty("ScopedServiceProvider", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
                var serviceProvider = (IServiceProvider)proInfo.GetValue(options);
                publisherSessionService = serviceProvider.GetService <PublisherSessionService>();
            }

            var _ = publisherSessionService ?? throw new InvalidOperationException("无法获取直播流");

            return(publisherSessionService.FindPublisher(streamName));
        }
Ejemplo n.º 2
0
 public async Task Stop()
 {
     using (serverTask)
         using (tokenSource)
         {
             try
             {
                 tokenSource.Cancel();
                 await serverTask;
             }
             catch (Exception e)
             {
             }
             server                  = null;
             serverTask              = null;
             tokenSource             = null;
             options                 = null;
             publisherSessionService = null;
         }
 }
Ejemplo n.º 3
0
 public LivingStream(PublisherSessionService publisherSessionService)
 {
     _publisherSessionService = publisherSessionService;
 }
Ejemplo n.º 4
0
 public MyLivingStream(PublisherSessionService publisherSessionService) : base(publisherSessionService)
 {
 }
 public WebSocketPlayController(PublisherSessionService publisherSessionService, RecordService recordService)
 {
     _publisherSessionService = publisherSessionService;
     _recordService           = recordService;
 }