我想在我的树莓派2上做一个网络摄像头广播应用程序,运行Windows IOT。
正如我们在Windows IOT samples中看到的,您可以录制视频,但不能
在网络上播放视频(以wifi格式)。在这段代码中,我使用MediaCapture类来获取视频流。
// 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方法,刷新流,并在循环中完成。
发布于 2015-11-25 23:36:01
我没有详细的解决方案,但有一个提示。我觉得录音不是你想要的。你只需要从veiwfinder抓取并上传预览流即可。为此,您需要将预览流发送到自定义接收器。在您的例子中,这将是一个从媒体捕获接收并将其发送到服务器的循环缓冲区。
您应该检查该方法:
MediaCapture.StartPreviewToCustomSinkAsync()https://stackoverflow.com/questions/33697735
复制相似问题