我正在开发一个音频/视频相关的应用程序,用户需要下载视频才能在本地播放,为此我正在使用此代码-
private void Button_Click_1(object sender, RoutedEventArgs e)
{
WebClient wb = new WebClient();
wb.OpenReadAsync(new Uri("Video url", UriKind.Absolute));
wb.DownloadProgressChanged += wbchange;
}
private void wbchange(object sender, DownloadProgressChangedEventArgs e)
{
progressBar2.Value = e.BytesReceived;
progressBar2.Maximum = e.TotalBytesToReceive;
}
它适用于小视频,但显示大视频错误错误是 -System.OutOfMemoryException: Insufficient memory to continue the execution of the program.
at MS.Internal.FrameworkCallbacks.NotifyManagedDebuggerOnNativeOOM()
请建议我一些方法来摆脱这个或任何其他方式来下载视频以获得更好的性能?
谢谢关心:)