我试图在运行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);
}