예제 #1
0
        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);
            });
        }
예제 #2
0
        public override void TearDown()
        {
            base.TearDown();

            ExecuteInMainThread(() =>
            {
                _playlist?.Close(PlaylistCloseFlag.ForceRemove);
            });
        }
예제 #3
0
        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);
            });
        }