Exemplo n.º 1
0
        private void LoadPlayer()
        {
            IMediaPlayerImplementation impl = null;

            if (!string.IsNullOrEmpty(Program.Args.Player))
            {
                playerName = Program.Args.Player;
            }

            if (string.IsNullOrEmpty(playerName))
            {
                Console.WriteLine("There was an error finding an appropriate player to load - loading in silent mode");
            }
            else
            {
                switch (playerName)
                {
                case "naudio":
                    impl = new NAudioImplementation();
                    break;

                case "mplayer":
                    impl = new MPlayerImplementation();
                    break;

                default:
                    Console.WriteLine("There was an error finding an appropriate player to load - loading in silent mode");
                    break;
                }
            }

            if (impl == null)
            {
                impl = new SilentImplementation();
            }

            Player = new MediaPlayer(impl, 50);
        }
Exemplo n.º 2
0
 public MediaPlayer(IMediaPlayerImplementation playerImpl, int volume)
 {
     this.playerImpl            = playerImpl;
     this.volume                = volume;
     this.playerImpl.SongEnded += Player_SongEnded;
 }