public VideoController( IHostingEnvironment hostingEnvironment, IVideoService service, IHubContext <VideoHub, IVideoHub> videoHub, IHubContext <ManagementHub, IManagementHub> managementHub) { _videoPath = $"{hostingEnvironment.WebRootPath}\\Videos"; _service = service; _videoHub = videoHub; _managementHub = managementHub; var categories = CategoryInfos(); var clientIdentities = GetClientIdentities1(); _service.Init(_videoPath, categories, clientIdentities); ManagementHub.AddNotifyEvent( (sender, args) => { _managementHub.Clients.All.getOnlineUsers(Utility.VideoUtility.GetClientCount()); } ); VideoHub.AddConnectedEvent( (senger, args) => { _service.AddClientIdentity( args.Id, args.Ip, true); _managementHub.Clients.All.getOnlineUsers(Utility.VideoUtility.GetClientCount()); }); VideoHub.AddDisconnectedEvent((senger, args) => { _service.AddClientIdentity( args.Id, args.Ip, false); _managementHub.Clients.All.getOnlineUsers(Utility.VideoUtility.GetClientCount()); }); }
private const long MediaChID = 1; //camera ID private static void SendingFrames() { VideoHub videoHub = new VideoHub(); while (play) { try { Thread.Sleep(GetTimeSleep()); // we calculate time span for 25FPS videoHub.Send(v.GetFrame()); } catch (Exception ex) { Logger.ERROR(MethodBase.GetCurrentMethod(), "Error sending frames", ex); } } }
public static void Picture() { //Send first frame VideoHub videoHub = new VideoHub(); v.Viewer(GngViewerPlayMode.pmPlayForward, MediaChID); //wait until we have images in queue while (v.images.Count < 1) { ; } videoHub.Send(v.GetFrame()); v.Dispose(); }
public VideoController( IVideoService videoService, IHubContext <VideoHub, IVideoHub> videoHub, IHubContext <ManagementHub, IManagementHub> managementHub) { _videoHub = videoHub; _managementHub = managementHub; _videoService = videoService; ManagementHub.AddNotifyEvent((sender, args) => { OnlineUserChange(); }); VideoHub.AddConnectedEvent((senger, args) => { ManagementHub.DoNotifyEvent(); }); VideoHub.AddDisconnectedEvent((senger, args) => { ManagementHub.DoNotifyEvent(); }); }