我正在尝试将MRC视频从Hololens流式传输到我的PC;有repo that does this,但播放媒体播放器的URI,我试图将其保存到文件中。我怎样才能做到这一点?我已经尝试过使用HttpClient,但是当我向URI发送请求时,应用程序似乎崩溃了。在我附加的链接中,有一个StartPlayback()方法,它将Media Player的source属性设置为URI,它似乎工作正常。我尝试用以下方式修改它:
private async void StartPlayback()
{
Uri link = new Uri(string.Format("mrvc://{0}:{1}", this.txAddress.Text, this.txPort.Text));
this.videoPlayer.Source = link;
using (var client = new HttpClient())
using (var response = await client.GetAsync(link))
{
// make sure our request was successful
response.EnsureSuccessStatusCode();
// read the filename from the Content-Disposition header
var filename = response.Content.Headers.ContentDisposition.FileName;
// read the downloaded file data
var stream = await response.Content.ReadAsStreamAsync();
// Where you want the file to be saved
var destinationFile = Path.Combine("C:\\Users\\orsteam\\Documents", filename);
// write the steam content into a file
using (var fileStream = File.Create(destinationFile))
{
stream.CopyTo(fileStream);
}
}
this.bnStart.IsEnabled = false;
this.bnStop.IsEnabled = true;
}
谢谢!
答案 0 :(得分:1)
在Unity中,您无权访问HttpClient。您可以更改为使用WWW类。
请务必检查//Inside your UITableViewCell
override func prepareForReuse() {
//Reset cell values here
}
能力。