public void GetPlayablePlaylist_ShouldReturnPlaylist() { IAimpPlaylist playlist = null; ExecuteInMainThread(() => { var playlistResult = Player.ServicePlaylistManager.CreatePlaylistFromFile(PlaylistPath, true); this.AreEqual(ActionResultType.OK, playlistResult.ResultType); playlist = playlistResult.Result; }); ExecuteInThread(() => { Thread.Sleep(10000); }); ExecuteInMainThread(() => { var result = Player.ServicePlaylistManager.GetPlayablePlaylist(); this.AreEqual(ActionResultType.OK, result.ResultType); this.NotNull(result.Result); playlist.Close(PlaylistCloseFlag.ForceRemove); }); }
public override void TearDown() { base.TearDown(); ExecuteInMainThread(() => { _playlist?.Close(PlaylistCloseFlag.ForceRemove); }); }
public void CheckHook_IAimpExtensionPlayerHook_OK() { IAimpPlaylist playList = null; ExecuteInMainThread(() => { var executed = false; var extension = new AimpExtensionPlayerHook(s => { executed = true; this.AreEqual(TrackUrl1, s, "fileUrl", "Source file url and hooked url do not match"); return(true); }); var result = Player.Core.RegisterExtension(extension); AssertOKResult(result.ResultType, "Unable to register a AimpExtensionPlayerHook"); var createPlaylistResult = Player.ServicePlaylistManager.CreatePlaylist("AimpExtensionPlayerHook", true); AssertOKResult(createPlaylistResult.ResultType, "Cannot create a playlist from file"); createPlaylistResult.Result.Add(TrackUrl1, PlaylistFlags.NoCheckFormat, PlaylistFilePosition.CurrentPosition); if (createPlaylistResult.ResultType == ActionResultType.OK) { playList = createPlaylistResult.Result; var r = Player.Play(createPlaylistResult.Result); } }); ExecuteAndWait(() => { Thread.Sleep(25000); }); ExecuteInMainThread(() => { playList?.Close(PlaylistCloseFlag.ForceRemove); }); }