我有一台计算机将 24/7 运行 WPF 程序并播放图像和视频的播放列表。当我启动我的程序时,一切正常,但可能在 2-3 小时后,mediaelement 窗口是黑色的。
当我启动程序时,它会将文件夹中的所有文件名放入列表框中
Dim root As String = MediaDir & "media"
Dim dir As New System.IO.DirectoryInfo(root)
Dim fileList = dir.GetFiles("*.*", System.IO.SearchOption.AllDirectories)
Dim fileQuery = From file In fileList _
Where file.Extension = ".jpg" _
Or file.Extension = ".avi" _
Or file.Extension = ".mov" _
Order By file.Name _
Select file
For Each file In fileQuery
listbox1.Items.Add(file.FullName)
Next
i = 0
Media_Org.Source = New Uri(listbox1.Items(i), UriKind.Relative)
下一部分是我使用 MediaEnded 加载下一个
Private Sub Media_Org_MediaEnded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Media_Org.MediaEnded
i = i + 1
If i = listbox1.Items.Count Then
i = 0
End If
Media_Org.Source = New Uri(listbox1.Items(i), UriKind.Relative)
End Sub
有什么建议么?
“我遇到的另一个问题是,当我播放视频时,cpu 会上升到 60-70%”