2015-11-13 44 views
2

我想在運行Windows IOT的Raspberry pi 2上製作網絡攝像頭廣播應用程序。Windows物聯網廣播網絡攝像頭

正如我們在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方法來訪問流。 使用計時器,我們可以記錄5秒鐘(例如)視頻,調用StopRecordAsync方法,刷新流並在循環中執行,但是。

+0

我只是想知道,你能使用比那些由微軟receommended以外的任何其他USB UVC攝像頭? – Arash

回答

0

我沒有詳細的解決方案,但提示。我認爲錄音不是你想要的。您只需要抓取並上傳來自veiwfinder的預覽流。爲此,您需要將預覽流發送到自定義接收器。在你的情況下,這將是從媒體捕獲接收並將它們發送到服務器的循環緩衝區。

您應該檢查方法:

MediaCapture.StartPreviewToCustomSinkAsync()