Added a timeout-fallback to PreviewStartHelper for the case the length can't be determinated

This commit is contained in:
lukeIam committed 2016-01-31 17:06:17 +01:00
1 parent d6fcd7b58c
commit 6dc5728554
1 file changed
+4 -1
+4 -1
View File
@@ -49,6 +49,8 @@ namespace Vocaluxe.Base
private static bool _Disabled;
private static Task PreviewStartHelperTask;
private static int PreviewStartWaitCounter;
private const int PreviewStartWaitMaxTries = 10;
public static bool VideoEnabled
{
@@ -252,11 +254,12 @@ namespace Vocaluxe.Base
public static void Update()
{
if (PreviewStartHelperTask != null && _PreviewPlayer.Length > 0)
if (PreviewStartHelperTask != null && ( _PreviewPlayer.Length > 0 || PreviewStartWaitCounter++ >= PreviewStartWaitMaxTries))
{
PreviewStartHelperTask.RunSynchronously(TaskScheduler.FromCurrentSynchronizationContext());
PreviewStartHelperTask.Dispose();
PreviewStartHelperTask = null;
PreviewStartWaitCounter = 0;
}
if (!IsPlaying)