[vlc-devel] [PATCH 2/2] Added a Task.Delay to wait for the mediaPlayer to start
Pablo Biagioli
pabiagioli at gmail.com
Thu Feb 9 02:38:24 CET 2017
---
app/VLC.Core/App.xaml.cs | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/app/VLC.Core/App.xaml.cs b/app/VLC.Core/App.xaml.cs
index 5672a1bf1..cb873be9d 100644
--- a/app/VLC.Core/App.xaml.cs
+++ b/app/VLC.Core/App.xaml.cs
@@ -214,8 +214,8 @@ namespace VLC
subsFd = await StorageFile.GetFileFromPathAsync(subsValue.Value);
if(subsFd == null)
ToastHelper.Basic("Failed to Load Subtitles: CoulnĀ“t find the file.");
- else if(!StorageApplicationPermissions.FutureAccessList.CheckAccess(subsFd))
- StorageApplicationPermissions.FutureAccessList.Add(subsFd);
+ //else if(!StorageApplicationPermissions.FutureAccessList.CheckAccess(subsFd))
+ // StorageApplicationPermissions.FutureAccessList.Add(subsFd);
break;
case "url":
using (var httpClient = new System.Net.Http.HttpClient())
@@ -258,8 +258,19 @@ namespace VLC
await Locator.MediaPlaybackViewModel.PlayStream(decoder[1].Value);
if (subsFd != null)
{
- ToastHelper.Basic("Subtitles Loaded Successfully");
- Locator.MediaPlaybackViewModel.OpenSubtitleCommand.Execute(subsFd);
+ await Task.Run(async () =>
+ {
+ //I should wait until _mediaPlayer != null
+ while (!Locator.MediaPlaybackViewModel.IsPlaying)
+ {
+ await Task.Delay(10);
+ }
+ await Dispatcher.RunAsync(CoreDispatcherPriority.High, () => {
+ Locator.MediaPlaybackViewModel.OpenSubtitleCommand.Execute(subsFd);
+ ToastHelper.Basic("Subtitles Loaded Successfully");
+ });
+
+ });
}
}
--
2.11.1.windows.1
More information about the vlc-devel
mailing list