Commit c2427206 authored by Martin Finkel's avatar Martin Finkel

Tests: Disable audio output

(cherry picked from commit 11d24ef3fa1a7bc2fe53c99bd9fc24f131e5fcfe)
parent a3e1b280
...@@ -8,10 +8,14 @@ namespace LibVLCSharp.Tests ...@@ -8,10 +8,14 @@ namespace LibVLCSharp.Tests
{ {
public abstract class BaseSetup public abstract class BaseSetup
{ {
protected LibVLC _libVLC;
[SetUp] [SetUp]
public void SetUp() public void SetUp()
{ {
Core.Initialize(); Core.Initialize();
_libVLC = new LibVLC("--no-audio", "--no-video");
} }
protected string RealStreamMediaPath => "http://streams.videolan.org/streams/mp3/Owner-MPEG2.5.mp3"; protected string RealStreamMediaPath => "http://streams.videolan.org/streams/mp3/Owner-MPEG2.5.mp3";
......
...@@ -13,15 +13,15 @@ namespace LibVLCSharp.Tests ...@@ -13,15 +13,15 @@ namespace LibVLCSharp.Tests
var dirPath = Path.GetDirectoryName(typeof(CoreLoadingTests).Assembly.Location); var dirPath = Path.GetDirectoryName(typeof(CoreLoadingTests).Assembly.Location);
var finalPath = Path.Combine(dirPath, "libvlc", "win-x86"); var finalPath = Path.Combine(dirPath, "libvlc", "win-x86");
Assert.DoesNotThrow(() => Core.Initialize(finalPath), "fail to load libvlc dll at specified location"); Assert.DoesNotThrow(() => Core.Initialize(finalPath), "fail to load libVLC dll at specified location");
var libvlc = new LibVLC(); var libVLC = new LibVLC("--no-audio", "--no-video");
} }
[Test] [Test]
public void LoadLibVLCFromInferredPath() public void LoadLibVLCFromInferredPath()
{ {
Assert.DoesNotThrow(() => Core.Initialize(), "fail to load libvlc dll at specified location"); Assert.DoesNotThrow(() => Core.Initialize(), "fail to load libVLC dll at specified location");
var libvlc = new LibVLC(); var libVLC = new LibVLC("--no-audio", "--no-video");
} }
} }
} }
\ No newline at end of file
...@@ -16,10 +16,9 @@ namespace LibVLCSharp.Tests ...@@ -16,10 +16,9 @@ namespace LibVLCSharp.Tests
[Ignore("requires network calls that may fail when run from CI")] [Ignore("requires network calls that may fail when run from CI")]
public async Task PostLogin() public async Task PostLogin()
{ {
var libVLC = new LibVLC();
var tcs = new TaskCompletionSource<bool>(); var tcs = new TaskCompletionSource<bool>();
libVLC.SetDialogHandlers((title, text) => Task.CompletedTask, _libVLC.SetDialogHandlers((title, text) => Task.CompletedTask,
(dialog, title, text, username, store, token) => (dialog, title, text, username, store, token) =>
{ {
// show UI dialog // show UI dialog
...@@ -32,9 +31,9 @@ namespace LibVLCSharp.Tests ...@@ -32,9 +31,9 @@ namespace LibVLCSharp.Tests
(dialog, title, text, indeterminate, position, cancelText, token) => Task.CompletedTask, (dialog, title, text, indeterminate, position, cancelText, token) => Task.CompletedTask,
(dialog, position, text) => Task.CompletedTask); (dialog, position, text) => Task.CompletedTask);
var mp = new MediaPlayer(libVLC) var mp = new MediaPlayer(_libVLC)
{ {
Media = new Media(libVLC, UrlRequireAuth, Media.FromType.FromLocation) Media = new Media(_libVLC, UrlRequireAuth, Media.FromType.FromLocation)
}; };
mp.Play(); mp.Play();
...@@ -48,10 +47,9 @@ namespace LibVLCSharp.Tests ...@@ -48,10 +47,9 @@ namespace LibVLCSharp.Tests
[Ignore("requires network calls that may fail when run from CI")] [Ignore("requires network calls that may fail when run from CI")]
public async Task ShouldThrowIfPostLoginsTwice() public async Task ShouldThrowIfPostLoginsTwice()
{ {
var libVLC = new LibVLC();
var tcs = new TaskCompletionSource<bool>(); var tcs = new TaskCompletionSource<bool>();
libVLC.SetDialogHandlers((title, text) => Task.CompletedTask, _libVLC.SetDialogHandlers((title, text) => Task.CompletedTask,
(dialog, title, text, username, store, token) => (dialog, title, text, username, store, token) =>
{ {
dialog.PostLogin(Username, Password, false); dialog.PostLogin(Username, Password, false);
...@@ -63,9 +61,9 @@ namespace LibVLCSharp.Tests ...@@ -63,9 +61,9 @@ namespace LibVLCSharp.Tests
(dialog, title, text, indeterminate, position, cancelText, token) => Task.CompletedTask, (dialog, title, text, indeterminate, position, cancelText, token) => Task.CompletedTask,
(dialog, position, text) => Task.CompletedTask); (dialog, position, text) => Task.CompletedTask);
var mp = new MediaPlayer(libVLC) var mp = new MediaPlayer(_libVLC)
{ {
Media = new Media(libVLC, UrlRequireAuth, Media.FromType.FromLocation) Media = new Media(_libVLC, UrlRequireAuth, Media.FromType.FromLocation)
}; };
mp.Play(); mp.Play();
...@@ -79,10 +77,9 @@ namespace LibVLCSharp.Tests ...@@ -79,10 +77,9 @@ namespace LibVLCSharp.Tests
[Ignore("requires network calls that may fail when run from CI")] [Ignore("requires network calls that may fail when run from CI")]
public async Task ShouldNotThrowAndReturnFalseIfDimissingTwice() public async Task ShouldNotThrowAndReturnFalseIfDimissingTwice()
{ {
var libVLC = new LibVLC();
var tcs = new TaskCompletionSource<bool>(); var tcs = new TaskCompletionSource<bool>();
libVLC.SetDialogHandlers((title, text) => Task.CompletedTask, _libVLC.SetDialogHandlers((title, text) => Task.CompletedTask,
(dialog, title, text, username, store, token) => (dialog, title, text, username, store, token) =>
{ {
var result = dialog.Dismiss(); var result = dialog.Dismiss();
...@@ -96,9 +93,9 @@ namespace LibVLCSharp.Tests ...@@ -96,9 +93,9 @@ namespace LibVLCSharp.Tests
(dialog, title, text, indeterminate, position, cancelText, token) => Task.CompletedTask, (dialog, title, text, indeterminate, position, cancelText, token) => Task.CompletedTask,
(dialog, position, text) => Task.CompletedTask); (dialog, position, text) => Task.CompletedTask);
var mp = new MediaPlayer(libVLC) var mp = new MediaPlayer(_libVLC)
{ {
Media = new Media(libVLC, UrlRequireAuth, Media.FromType.FromLocation) Media = new Media(_libVLC, UrlRequireAuth, Media.FromType.FromLocation)
}; };
mp.Play(); mp.Play();
...@@ -110,19 +107,17 @@ namespace LibVLCSharp.Tests ...@@ -110,19 +107,17 @@ namespace LibVLCSharp.Tests
[Test] [Test]
public void ShouldUnsetDialogHandlersWhenInstanceDisposed() public void ShouldUnsetDialogHandlersWhenInstanceDisposed()
{ {
var libVLC = new LibVLC(); _libVLC.SetDialogHandlers((title, text) => Task.CompletedTask,
libVLC.SetDialogHandlers((title, text) => Task.CompletedTask,
(dialog, title, text, username, store, token) => Task.CompletedTask, (dialog, title, text, username, store, token) => Task.CompletedTask,
(dialog, title, text, type, cancelText, actionText, secondActionText, token) => Task.CompletedTask, (dialog, title, text, type, cancelText, actionText, secondActionText, token) => Task.CompletedTask,
(dialog, title, text, indeterminate, position, cancelText, token) => Task.CompletedTask, (dialog, title, text, indeterminate, position, cancelText, token) => Task.CompletedTask,
(dialog, position, text) => Task.CompletedTask); (dialog, position, text) => Task.CompletedTask);
Assert.True(libVLC.DialogHandlersSet); Assert.True(_libVLC.DialogHandlersSet);
libVLC.Dispose(); _libVLC.Dispose();
Assert.False(libVLC.DialogHandlersSet); Assert.False(_libVLC.DialogHandlersSet);
} }
} }
} }
\ No newline at end of file
...@@ -12,7 +12,7 @@ namespace LibVLCSharp.Tests ...@@ -12,7 +12,7 @@ namespace LibVLCSharp.Tests
[Test] [Test]
public void MetaChangedEventSubscribe() public void MetaChangedEventSubscribe()
{ {
var media = new Media(new LibVLC(), Path.GetTempFileName()); var media = new Media(_libVLC, Path.GetTempFileName());
var eventHandlerCalled = false; var eventHandlerCalled = false;
const Media.MetadataType description = Media.MetadataType.Description; const Media.MetadataType description = Media.MetadataType.Description;
media.MetaChanged += (sender, args) => media.MetaChanged += (sender, args) =>
...@@ -26,7 +26,7 @@ namespace LibVLCSharp.Tests ...@@ -26,7 +26,7 @@ namespace LibVLCSharp.Tests
public void DurationChanged() public void DurationChanged()
{ {
var media = new Media(new LibVLC(), RealMp3Path); var media = new Media(_libVLC, RealMp3Path);
var called = false; var called = false;
long duration = 0; long duration = 0;
...@@ -45,7 +45,7 @@ namespace LibVLCSharp.Tests ...@@ -45,7 +45,7 @@ namespace LibVLCSharp.Tests
[Test] [Test]
public void FreedMedia() public void FreedMedia()
{ {
var media = new Media(new LibVLC(), RealMp3Path); var media = new Media(_libVLC, RealMp3Path);
var eventCalled = false; var eventCalled = false;
media.MediaFreed += (sender, args) => media.MediaFreed += (sender, args) =>
{ {
...@@ -60,7 +60,7 @@ namespace LibVLCSharp.Tests ...@@ -60,7 +60,7 @@ namespace LibVLCSharp.Tests
[Test] [Test]
public async Task OpeningStateChanged() public async Task OpeningStateChanged()
{ {
var media = new Media(new LibVLC(), RealMp3Path); var media = new Media(_libVLC, RealMp3Path);
var tcs = new TaskCompletionSource<bool>(); var tcs = new TaskCompletionSource<bool>();
var openingCalled = false; var openingCalled = false;
media.StateChanged += (sender, args) => media.StateChanged += (sender, args) =>
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using LibVLCSharp.Shared; using LibVLCSharp.Shared;
using NUnit.Framework; using NUnit.Framework;
...@@ -15,23 +14,20 @@ namespace LibVLCSharp.Tests ...@@ -15,23 +14,20 @@ namespace LibVLCSharp.Tests
[Test] [Test]
public void DisposeInstanceNativeRelease() public void DisposeInstanceNativeRelease()
{ {
var libVLC = new LibVLC(); _libVLC.Dispose();
libVLC.Dispose(); Assert.AreEqual(IntPtr.Zero, _libVLC.NativeReference);
Assert.AreEqual(IntPtr.Zero, libVLC.NativeReference);
} }
[Test] [Test]
public void AddInterface() public void AddInterface()
{ {
var libVLC = new LibVLC(); Assert.True(_libVLC.AddInterface(string.Empty));
Assert.True(libVLC.AddInterface(string.Empty));
} }
[Test] [Test]
public void AudioFilters() public void AudioFilters()
{ {
var libVLC = new LibVLC(); var audioFilters = _libVLC.AudioFilters;
var audioFilters = libVLC.AudioFilters;
foreach (var filter in audioFilters) foreach (var filter in audioFilters)
{ {
Debug.WriteLine(filter.Help); Debug.WriteLine(filter.Help);
...@@ -44,8 +40,7 @@ namespace LibVLCSharp.Tests ...@@ -44,8 +40,7 @@ namespace LibVLCSharp.Tests
[Test] [Test]
public void VideoFilters() public void VideoFilters()
{ {
var libVLC = new LibVLC(); var videoFilters = _libVLC.VideoFilters;
var videoFilters = libVLC.VideoFilters;
foreach (var filter in videoFilters) foreach (var filter in videoFilters)
{ {
Debug.WriteLine(filter.LongName); Debug.WriteLine(filter.LongName);
...@@ -57,8 +52,7 @@ namespace LibVLCSharp.Tests ...@@ -57,8 +52,7 @@ namespace LibVLCSharp.Tests
[Test] [Test]
public void AudioOutputs() public void AudioOutputs()
{ {
var libVLC = new LibVLC(); var audioOuputs = _libVLC.AudioOutputs;
var audioOuputs = libVLC.AudioOutputs;
foreach (var audioOutput in audioOuputs) foreach (var audioOutput in audioOuputs)
{ {
Debug.WriteLine(audioOutput.Name); Debug.WriteLine(audioOutput.Name);
...@@ -69,10 +63,9 @@ namespace LibVLCSharp.Tests ...@@ -69,10 +63,9 @@ namespace LibVLCSharp.Tests
[Test] [Test]
public void AudioOutputDevices() public void AudioOutputDevices()
{ {
var libVLC = new LibVLC(); var outputs = _libVLC.AudioOutputs;
var outputs = libVLC.AudioOutputs;
var name = outputs.First(output => output.Name.Equals("mmdevice")).Name; var name = outputs.First(output => output.Name.Equals("mmdevice")).Name;
var audioOutputDevices = libVLC.AudioOutputDevices(name); var audioOutputDevices = _libVLC.AudioOutputDevices(name);
foreach (var audioOutputDevice in audioOutputDevices) foreach (var audioOutputDevice in audioOutputDevices)
{ {
...@@ -84,22 +77,20 @@ namespace LibVLCSharp.Tests ...@@ -84,22 +77,20 @@ namespace LibVLCSharp.Tests
[Test] [Test]
public void EqualityTests() public void EqualityTests()
{ {
Assert.AreNotSame(new LibVLC(), new LibVLC()); Assert.AreNotSame(new LibVLC("--no-audio"), new LibVLC("--no-audio"));
} }
[Test] [Test]
public void Categories() public void Categories()
{ {
var libVLC = new LibVLC(); var md1 = _libVLC.MediaDiscoverers(MediaDiscovererCategory.Devices);
var md1 = libVLC.MediaDiscoverers(MediaDiscovererCategory.Devices); var md2 = _libVLC.MediaDiscoverers(MediaDiscovererCategory.Lan);
var md2 = libVLC.MediaDiscoverers(MediaDiscovererCategory.Lan); var md3 = _libVLC.MediaDiscoverers(MediaDiscovererCategory.Localdirs);
var md3 = libVLC.MediaDiscoverers(MediaDiscovererCategory.Localdirs);
} }
[Test] [Test]
public void SetExitHandler() public void SetExitHandler()
{ {
var libVLC = new LibVLC();
var called = false; var called = false;
var exitCb = new ExitCallback(() => var exitCb = new ExitCallback(() =>
...@@ -107,9 +98,9 @@ namespace LibVLCSharp.Tests ...@@ -107,9 +98,9 @@ namespace LibVLCSharp.Tests
called = true; called = true;
}); });
libVLC.SetExitHandler(exitCb, IntPtr.Zero); _libVLC.SetExitHandler(exitCb, IntPtr.Zero);
libVLC.Dispose(); _libVLC.Dispose();
Assert.IsTrue(called); Assert.IsTrue(called);
} }
...@@ -117,16 +108,15 @@ namespace LibVLCSharp.Tests ...@@ -117,16 +108,15 @@ namespace LibVLCSharp.Tests
[Test] [Test]
public async Task SetLogCallback() public async Task SetLogCallback()
{ {
var libVLC = new LibVLC();
var logCallbackCalled = false; var logCallbackCalled = false;
void LogCallback(object sender, LogEventArgs args) => logCallbackCalled = true; void LogCallback(object sender, LogEventArgs args) => logCallbackCalled = true;
libVLC.Log += LogCallback; _libVLC.Log += LogCallback;
await Task.Delay(1000); await Task.Delay(1000);
libVLC.Log -= LogCallback; _libVLC.Log -= LogCallback;
Assert.IsTrue(logCallbackCalled); Assert.IsTrue(logCallbackCalled);
} }
...@@ -134,10 +124,9 @@ namespace LibVLCSharp.Tests ...@@ -134,10 +124,9 @@ namespace LibVLCSharp.Tests
[Test] [Test]
public void SetLogFile() public void SetLogFile()
{ {
var libVLC = new LibVLC();
var path = Path.GetTempFileName(); var path = Path.GetTempFileName();
libVLC.SetLogFile(path); _libVLC.SetLogFile(path);
libVLC.UnsetLog(); _libVLC.UnsetLog();
var logs = File.ReadAllText(path); var logs = File.ReadAllText(path);
Assert.True(logs.StartsWith("VLC media player")); Assert.True(logs.StartsWith("VLC media player"));
} }
...@@ -145,21 +134,19 @@ namespace LibVLCSharp.Tests ...@@ -145,21 +134,19 @@ namespace LibVLCSharp.Tests
[Test] [Test]
public void DisposeLibVLC() public void DisposeLibVLC()
{ {
var libvlc = new LibVLC(); _libVLC.SetLog((data, logLevel, logContext, format, args) => { });
_libVLC.SetDialogHandlers((title, text) => Task.CompletedTask,
libvlc.SetLog((data, logLevel, logContext, format, args) => { });
libvlc.SetDialogHandlers((title, text) => Task.CompletedTask,
(dialog, title, text, defaultUsername, askStore, token) => Task.CompletedTask, (dialog, title, text, defaultUsername, askStore, token) => Task.CompletedTask,
(dialog, title, text, type, cancelText, firstActionText, secondActonText, token) => Task.CompletedTask, (dialog, title, text, type, cancelText, firstActionText, secondActonText, token) => Task.CompletedTask,
(dialog, title, text, indeterminate, position, cancelText, token) => Task.CompletedTask, (dialog, title, text, indeterminate, position, cancelText, token) => Task.CompletedTask,
(dialog, position, text) => Task.CompletedTask); (dialog, position, text) => Task.CompletedTask);
Assert.IsTrue(libvlc.DialogHandlersSet); Assert.IsTrue(_libVLC.DialogHandlersSet);
libvlc.Dispose(); _libVLC.Dispose();
Assert.AreEqual(IntPtr.Zero, libvlc.NativeReference); Assert.AreEqual(IntPtr.Zero, _libVLC.NativeReference);
Assert.IsFalse(libvlc.DialogHandlersSet); Assert.IsFalse(_libVLC.DialogHandlersSet);
} }
} }
} }
\ No newline at end of file
...@@ -11,9 +11,8 @@ namespace LibVLCSharp.Tests ...@@ -11,9 +11,8 @@ namespace LibVLCSharp.Tests
[Test] [Test]
public void CreateStartAndStopDiscoverer() public void CreateStartAndStopDiscoverer()
{ {
var libVLC = new LibVLC(); var mds = _libVLC.MediaDiscoverers(MediaDiscovererCategory.Lan);
var mds = libVLC.MediaDiscoverers(MediaDiscovererCategory.Lan); var md = new MediaDiscoverer(_libVLC, mds.First().Name);
var md = new MediaDiscoverer(libVLC, mds.First().Name);
Assert.True(md.Start()); Assert.True(md.Start());
Assert.True(md.IsRunning); Assert.True(md.IsRunning);
md.Stop(); md.Stop();
...@@ -23,9 +22,8 @@ namespace LibVLCSharp.Tests ...@@ -23,9 +22,8 @@ namespace LibVLCSharp.Tests
[Test] [Test]
public void DisposeMediaDiscoverer() public void DisposeMediaDiscoverer()
{ {
var libVLC = new LibVLC(); var mds = _libVLC.MediaDiscoverers(MediaDiscovererCategory.Lan);
var mds = libVLC.MediaDiscoverers(MediaDiscovererCategory.Lan); var md = new MediaDiscoverer(_libVLC, mds.First().Name);
var md = new MediaDiscoverer(libVLC, mds.First().Name);
Assert.True(md.Start()); Assert.True(md.Start());
Assert.True(md.IsRunning); Assert.True(md.IsRunning);
Assert.NotNull(md.MediaList); Assert.NotNull(md.MediaList);
......
...@@ -11,9 +11,8 @@ namespace LibVLCSharp.Tests ...@@ -11,9 +11,8 @@ namespace LibVLCSharp.Tests
[Test] [Test]
public void AddAndRemoveMediaFromMediaList() public void AddAndRemoveMediaFromMediaList()
{ {
var libVLC = new LibVLC(); var mediaList = new MediaList(_libVLC);
var mediaList = new MediaList(libVLC); var media = new Media(_libVLC, Path.GetTempFileName());
var media = new Media(libVLC, Path.GetTempFileName());
var itemAdded = false; var itemAdded = false;
var itemDeleted = false; var itemDeleted = false;
mediaList.ItemAdded += (sender, args) => itemAdded = true; mediaList.ItemAdded += (sender, args) => itemAdded = true;
...@@ -33,7 +32,7 @@ namespace LibVLCSharp.Tests ...@@ -33,7 +32,7 @@ namespace LibVLCSharp.Tests
[Test] [Test]
public void AcquireLockTwiceThrows() public void AcquireLockTwiceThrows()
{ {
var mediaList = new MediaList(new LibVLC()); var mediaList = new MediaList(_libVLC);
mediaList.Lock(); mediaList.Lock();
Assert.Throws<InvalidOperationException>(() => mediaList.Lock(), "already locked"); Assert.Throws<InvalidOperationException>(() => mediaList.Lock(), "already locked");
} }
...@@ -41,7 +40,7 @@ namespace LibVLCSharp.Tests ...@@ -41,7 +40,7 @@ namespace LibVLCSharp.Tests
[Test] [Test]
public void ReleaseLockTwiceThrows() public void ReleaseLockTwiceThrows()
{ {
var mediaList = new MediaList(new LibVLC()); var mediaList = new MediaList(_libVLC);
mediaList.Lock(); mediaList.Lock();
mediaList.Unlock(); mediaList.Unlock();
Assert.Throws<InvalidOperationException>(() => mediaList.Unlock(), "not locked"); Assert.Throws<InvalidOperationException>(() => mediaList.Unlock(), "not locked");
...@@ -50,7 +49,7 @@ namespace LibVLCSharp.Tests ...@@ -50,7 +49,7 @@ namespace LibVLCSharp.Tests
[Test] [Test]
public void DisposeMediaList() public void DisposeMediaList()
{ {
var mediaList = new MediaList(new LibVLC()); var mediaList = new MediaList(_libVLC);
mediaList.Dispose(); mediaList.Dispose();
Assert.AreEqual(IntPtr.Zero, mediaList.NativeReference); Assert.AreEqual(IntPtr.Zero, mediaList.NativeReference);
} }
......
...@@ -15,7 +15,7 @@ namespace LibVLCSharp.Tests ...@@ -15,7 +15,7 @@ namespace LibVLCSharp.Tests
[Test] [Test]
public void CreateAndDestroy() public void CreateAndDestroy()
{ {
var mp = new MediaPlayer(new LibVLC()); var mp = new MediaPlayer(_libVLC);
mp.Dispose(); mp.Dispose();
Assert.AreEqual(IntPtr.Zero, mp.NativeReference); Assert.AreEqual(IntPtr.Zero, mp.NativeReference);
} }
...@@ -23,7 +23,7 @@ namespace LibVLCSharp.Tests ...@@ -23,7 +23,7 @@ namespace LibVLCSharp.Tests
[Test] [Test]
public void OutputDeviceEnum() public void OutputDeviceEnum()
{ {
var mp = new MediaPlayer(new LibVLC()); var mp = new MediaPlayer(_libVLC);
var t = mp.OutputDeviceEnum; var t = mp.OutputDeviceEnum;
Debug.WriteLine(t); Debug.WriteLine(t);
} }
...@@ -31,16 +31,14 @@ namespace LibVLCSharp.Tests ...@@ -31,16 +31,14 @@ namespace LibVLCSharp.Tests
[Test] [Test]
public async Task TrackDescription() public async Task TrackDescription()
{ {
var libVLC = new LibVLC(); var mp = new MediaPlayer(_libVLC);
var mp = new MediaPlayer(libVLC); var media = new Media(_libVLC, "http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4", Media.FromType.FromLocation);
var media = new Media(libVLC, "http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4", Media.FromType.FromLocation);
var tcs = new TaskCompletionSource<bool>(); var tcs = new TaskCompletionSource<bool>();
mp.Media = media; mp.Media = media;
mp.Play(); mp.Play();
mp.Playing += (sender, args) => mp.Playing += (sender, args) =>
{ {
Assert.Zero(mp.AudioTrack);
var description = mp.AudioTrackDescription; var description = mp.AudioTrackDescription;
Assert.True(mp.SetAudioTrack(description.First().Id));