C# Windows IOT广播网络摄像头
我想在运行Windows IOT的Raspberry pi 2上制作一个网络摄像头广播应用程序 正如我们在Windows中看到的,您可以录制视频,但不能 在网络上播放视频(作为wifi)。 在这段代码中,我使用MediaCapture类来获取视频流C# Windows IOT广播网络摄像头,c#,.net,windows,uwp,iot,C#,.net,Windows,Uwp,Iot,我想在运行Windows IOT的Raspberry pi 2上制作一个网络摄像头广播应用程序 正如我们在Windows中看到的,您可以录制视频,但不能 在网络上播放视频(作为wifi)。 在这段代码中,我使用MediaCapture类来获取视频流 // this._mediaCapture is a MediaCapture variable, initialized // there is a MediaElement item to see the
// this._mediaCapture is a MediaCapture variable, initialized
// there is a MediaElement item to see the video
InMemoryRandomAccessStream stream = new InMemoryRandomAccessStream();
MediaEncodingProfile profile = MediaEncodingProfile.CreateMp4(VideoEncodingQuality.Auto);
// starting recording to stream
await this._mediaCapture.StartRecordToStreamAsync(profile,stream);
// stopping recording to access the stream
await this._mediaCapture.StopRecordAsync();
//linking the stream to a MediaElement item to see the video
await stream.FlushAsync();
MediaElement.SetSource(stream, "video / mp4");
MediaElement.Play();
return stream;
问题是我们必须调用StopRecordAsync方法来访问流。
使用计时器,我们可以录制5s(例如)视频,调用StopRecordAsync方法,刷新流并在循环中执行。但是,我没有详细的解决方案,只有一个提示。我认为录音不是你想要的。您只需要从veiwfinder获取并上传预览流。为此,您需要将预览流发送到自定义接收器。在您的情况下,这将是一个循环缓冲区,接收媒体捕获并将其发送到服务器 您应该检查以下方法:
MediaCapture.StartPreviewToCustomSinkAsync()
我只是想知道,除了微软最近推荐的USB UVC摄像头,你还能使用其他USB UVC摄像头吗?