我正在尝试制作可以在运行 Windows 10 IoT Core 的 Raspberry PI 上打开视频选择随机文件的应用程序。但我收到以下错误:
代码:
private async void button1_Click(object sender, RoutedEventArgs e)
{
await VideoAc();
}
private async Task VideoAc()
{
Debug.WriteLine("Video opening");
RandomVideo();
video.AutoPlay = true;
video.Visibility = Visibility.Visible;
video.Play();
}
private void video_MediaEnded(object sender, RoutedEventArgs e)
{
video.AutoPlay = false;
video.Visibility = Visibility.Collapsed;
}
private void RandomVideo()
{
var random = new Random();
var fileNames = Directory.GetFiles("ms-appx:///wmv", "*.wmv", SearchOption.AllDirectories);
var path = fileNames[random.Next(0, fileNames.Length)];
Debug.WriteLine(path);
video.Source = new Uri(path);
}