Windows物联网广播networking摄像头

我想在运行Windows IOT的Raspberry pi 2上制作Webcam Broadcast应用程序。

正如我们在Windows IOT示例中看到的那样,您可以录制video,但不能

在networking上播放video(如wifi)。 在这段代码中,我使用MediaCapture类来获取videostream。

// 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方法来访问stream。 有了一个定时器,我们可以logging一个5秒(例如)的video,调用StopRecordAsync方法,刷新stream,并在一个循环,但是。

我没有详细的解决方案,但提示。 我觉得录音不是你想要的。 你只是想抓取并上传来自veiwfinder的预览流。 为此,您需要将预览流发送到自定义接收器。 在你的情况下,这将是从媒体捕获接收并发送到服务器的循环缓冲区。

你应该检查方法:

 MediaCapture.StartPreviewToCustomSinkAsync()