Added a timeout-fallback to PreviewStartHelper for the case the length can't be determinated
This commit is contained in:
1 parent
d6fcd7b58c
commit
6dc5728554
1 file changed
+4
-1
@@ -49,6 +49,8 @@ namespace Vocaluxe.Base
|
|||||||
private static bool _Disabled;
|
private static bool _Disabled;
|
||||||
|
|
||||||
private static Task PreviewStartHelperTask;
|
private static Task PreviewStartHelperTask;
|
||||||
|
private static int PreviewStartWaitCounter;
|
||||||
|
private const int PreviewStartWaitMaxTries = 10;
|
||||||
|
|
||||||
public static bool VideoEnabled
|
public static bool VideoEnabled
|
||||||
{
|
{
|
||||||
@@ -252,11 +254,12 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static void Update()
|
public static void Update()
|
||||||
{
|
{
|
||||||
if (PreviewStartHelperTask != null && _PreviewPlayer.Length > 0)
|
if (PreviewStartHelperTask != null && ( _PreviewPlayer.Length > 0 || PreviewStartWaitCounter++ >= PreviewStartWaitMaxTries))
|
||||||
{
|
{
|
||||||
PreviewStartHelperTask.RunSynchronously(TaskScheduler.FromCurrentSynchronizationContext());
|
PreviewStartHelperTask.RunSynchronously(TaskScheduler.FromCurrentSynchronizationContext());
|
||||||
PreviewStartHelperTask.Dispose();
|
PreviewStartHelperTask.Dispose();
|
||||||
PreviewStartHelperTask = null;
|
PreviewStartHelperTask = null;
|
||||||
|
PreviewStartWaitCounter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsPlaying)
|
if (!IsPlaying)
|
||||||
|
|||||||
Reference in new issue
Block a user