1

I'm looking for a way of capturing current desktop view (or choose a single window to capture is ok too). I found tons of ways to stream a video file or capture desktop to video file, but nothing on my topic, i.e no files at all.

The main idea is taken from Skype's desktop demo, which provides video and sound stream of user's desktop to another user on even to several users in a group talk. So i'm looking for similar library (if something like that even exist), or atleast a direction on how to do that. The resulting program should be able to stream to like 1-4 users. One more requirement is ability to catch-up stream if some packets were lost during transition (i.e. short connection drop).

C++ solution is also ok, but C# is better if it would be less complex. Thanks in advance.

upd: .NET Desktop application, not asp.net or .NET core

SelfishCrawler
  • 225
  • 2
  • 12

1 Answers1

2

Just code it (paste it together) yourself

  1. Capture screenshot of active window?
  2. ASP .NET Core app with SignalR: https://learn.microsoft.com/en-us/aspnet/core/tutorials/signalr-typescript-webpack?view=aspnetcore-2.2&tabs=visual-studio
  3. Instead ChatHub crate e.g. ImageStreamHub (2 methods Start(); Stop(); )
  4. Start() - will start to take screenshots in a loop and send it through web socket (await Clients.All.SendAsync("imageReceived", image);)
  5. Stop() - will, you guessed it, terminate the loop

ALTERNATIVE: Look at this: https://learn.microsoft.com/en-us/aspnet/core/signalr/streaming?view=aspnetcore-2.2

and just instead of sending numbers, send images

David
  • 112
  • 1
  • 8
  • It's not asp.net core, it's default .net desktop app. I thought on capturing images, but how to synchronize it with sound stream then? – SelfishCrawler Jul 17 '19 at 09:10
  • Well...I don't know how to stream peer to peer in .net, so you would need some kind of server( can run locally)... so I would suggest to use some code/library to capture video+audio (in the original question you wrote you found some solution for capturing video with audio) send it to server and then clients can just be subscribed to that stream from the server – David Jul 17 '19 at 09:22
  • Yes but that solution captures to something like .avi file, so the problem is to capture those to memory instead. Peer-to-peer isn't mandatory, server is pretty ok here. – SelfishCrawler Jul 17 '19 at 09:24
  • Do you have link to that solution? – David Jul 17 '19 at 12:02
  • Yeah, this is something that can capture .avi: [link](https://github.com/baSSiLL/SharpAvi) – SelfishCrawler Jul 18 '19 at 07:50
  • 1
    Well... AviWriter class which is used in their Sample project has 2 constructors, one that takes filename and the other takes System.IO.Stream so you are basically done , just send bytes from that stream – David Jul 18 '19 at 13:07
  • Seems that you found a solution for my problem, gonna try it now! Thank you! – SelfishCrawler Jul 18 '19 at 16:47