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)); }
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; } }
public LivingStream(PublisherSessionService publisherSessionService) { _publisherSessionService = publisherSessionService; }
public MyLivingStream(PublisherSessionService publisherSessionService) : base(publisherSessionService) { }
public WebSocketPlayController(PublisherSessionService publisherSessionService, RecordService recordService) { _publisherSessionService = publisherSessionService; _recordService = recordService; }