EventHandler<AudioDeviceRunningChangedEventArgs> eventHandler = (s, e) =>
{
+ Log.Info("Tizen.Multimedia.Tests", $"RunningChanged event raised : {e.IsRunning}");
if (e.IsRunning)
{
tcs.TrySetResult(true);
AudioManager.DeviceRunningChanged += eventHandler;
// We need to play anything in BACKGROUND for checking whether IsRunning returns true or not.
- Task.Run(() => TonePlayer.StartAsync(ToneType.Default, audioStreamPolicy, 1000, cts.Token));
+ var task = Task.Run(() =>
+ {
+ var timer = new global::System.Timers.Timer() { Interval = 500 };
+ timer.Elapsed += (s, e) =>
+ {
+ if (Thread.Yield())
+ {
+ Log.Info("Tizen.Multimedia.Tests", "Current thread was yielded.");
+ }
+ };
+
+ TonePlayer.StartAsync(ToneType.Default, audioStreamPolicy, 2000, cts.Token);
+ });
+
+ while (task.Status != TaskStatus.Running)
+ {
+ Log.Info("Tizen.Multimedia.Tests", "Sleep 50ms");
+ Thread.Sleep(50);
+ }
Assert.That(await tcs.Task);
}