Stream video from web camera using UWP app in C# - c#

I am trying to stream video from my webcam (audio and video) from .NET UWP IOT application.
I tried this WebCamApp sample from https://github.com/ms-iot/samples and it works perfectly. Now I would like to play with streaming that video to another PC/device. I am open to your suggestions on how to approach this. In past I was dealing with RTSP, but not on this platform. So far I saw that limitation is the .NET Core.
Are there any libraries for this? Or should i write something from scratch? What are your suggestions?

I don't have a complete solution, but what you're looking for is real time streaming. and I recommend using WebRTC.
WebRTC is a project built by google to support real time communication, you can play around with the sample from this website:
https://www.webrtc-experiment.com/
I found also this port for UWP, applications. But I'm not sure if it works with IOT:
https://www.nuget.org/packages/WebRTC/

Related

Xamarin.forms .NetStandard How to play a video?

I currently developing a Xamarin.form app that use .NetStandard as code sharing technique.
On a certain point in the app, the app must show a video from a url. A video could take up to 5 minutes.
I currently can't find a way how I can play a video in my Xamarin.Forms app.
Most of the examples on the web using PCL with .NET Framework.
I tried This plug in, but it isn't fully supported for .NetStandard, since it is written for .Net Framework:
https://github.com/martijn00/XamarinMediaManager
I already managed to play a video on Android and iOs following this tutorial:
https://blog.xamarin.com/delivering-rich-media-experiences-xamarin-forms-video-player/
However, it can only play videos up to 15 seconds for free and in UWP, it seems to be a bit broken.
I simply cannot figure out how I can play a video up to 5 minutes using .Net Standard.
Can someone please explain step by step how I can show a video in a Xamarin.Form app using .NetStandard as code sharing technique?
Or If anyone could explain in detail how to make my own video control, that works on each platform, that would be fantastic.
Your help is really much appreciated.
You may want to have a look at LibVLCSharp which provides a netstandard target as well as well native controls for each platforms.
Disclaimer: I am the maintainer.
You can find a full tutorial how implementing a video(local or web) in your app
manually at Xamarin documentation
either there is a sample

Stream video to rtmp server in Xamarin.Forms.iOS?

I am currently working on a solution where i want to livestream from my app. I succesfully get my camerastream working with avfoundation. The next step in order to complete my task is to send my video frames to a rtmp server but I am not sure on how i can accomplish this in xamarin forms ios.
For swift there is a library called https://github.com/jgh-/VideoCore that solves this but do we have something similiar in xamarin (any library) or documentation on examples that tackles this issue?
Thanks a lot!
Maybe it's a bit late for you, but this can probably help someone who wants to do the same thing (like I did), you can use the Xamarin port of LFLiveKit:
https://github.com/rhedgpeth/Xamarin-LFLiveKit
You'll have to implement a custom renderer to use it with forms, but it's not too hard if you follow the sample project in the repository.

Capture camera using DirectShow

I'm developping a SmartDevice application (Pocket PC 2003 template) in C# for a device with Windows Mobile 6.1. I need to use the camera of this device (photos, video); to do this work i tried using the CameraCaptureDialog class but it does not work for Pocket PC applications.
So, I documented on the internet and found that I probably refer to DirectShow API, but the problem is that I do not know where to start because I can't found a working/correct example.
My questions:
Is this the right way? Are there alternatives?
Where I can find a very good example that shows how to do this work?
You may try directshowbetcf: http://alexmogurenko.com/blog/directshownetcf/ if you really want to go with DirectShow and NetCF.
There's plenty of examples of directshow on the web. There is a site dedicated to converting the API over to C# which makes it a lot easier, maybe this was it http://directshownet.sourceforge.net/about.html. I struggled with DirectShow until I read the book "programming directshow" from microsoft press. About a third of that way through that book it all seemed incredibly easy and I was able to complete what I wanted. In the end it's a lot like referencing any library and using the classes from within that library. The added difficulty is that you need to add wrappers because they are all COM objects but that has been done for you.
This might be useful to you to understand the DirectShow technology. Basically gives a start to DirctShow and explains some of the important points. But its C++ not C#. Hope this help
Basic Video Capture
DirectShow is the video capture API in Windows Mobile 6. There is a Video Capture Filter there and all in all things are designed pretty much the same way they are in Windows.
The problem is that however that this is a native API, and not just in Windows Mobile. To develop in C# you need some bindings and they are missing. On desktop there is DirectShow.NET, which is a missing piece, but it does not seem to fit well for CE. Yet you still need to fill this gap in Windows Mobile.
To work it around you have a few ways, the first would be to go through DirectShow.NET and update it appropriately to start working on your device, strip parts missing in mobile OS etc. This would get you a twin for DS.NET but for mobile operating system.
Another option would be to do some C++ development and implement the minimal sufficient feature set in that domain, exposing the component via COM. Then you will reference this from managed code and things will get connected together. And another obvious option would be to use a third party solution which already does one of the mentioned above.

How to stream multimedia files using C# and ASP.NET in P2P manner?

so what I want to do is build up a custom web player that should have the facility to allow any user to select a file from his local hard disk and the play that, so that some other person can view it in real time, just like doing a video chat, but instead of a webcam, there would be a video clip that is being streamed.
so far, what I've come across is Microsoft's SmoothStreaming Framework, but it did not help much. Please help.
Regards.
See following posts, hopefully it might be helpful.
Streaming with Windows Media Services and ASP.NET
Microsoft Media Platform: Player Framework

c# webcam controls?

I am looking to put a camera on top of a my lab in the process of being built and stream it to a website.
How can I be doing this with only c# ? How to get stream of video & send it live on server PC from there he can take instant photos?
Modern web cameras would supports WIA and DirectShow. WIA has a scripting interface which is more friendly to C#, however it is designed for cameras and scanners and is not that fast for streaming. But if you just need to push the image to a server, you don't need to write code, kist use Windows Media Encoder to push to a Windows Media Server's publishing point. You can then get image from the server's publishing point using DirectShow or Windows Media Format SDK. None of these are easy in C# though, you are better off using COM class libraries like ATL for extensive COM programming like this.
If you really want to write this in C#, I've had a lot of success with Egmu.
Capturing images is very straightforward - see this question. After that, it'd be FTP to the server as usual.
I'm curious about Sheng Jiang's Media Encoder solution though. Let me know how you get on.

Categories