SEARCH C# PROGRAMMING CODES HERE

Media Player in C# Visual Studio By Rohit Programming Zone

Media Player  in C# Visual Studio



 

Source Code

-----------------------------------------------------------------------------------------------------------------------------

using System;

using System.Windows.Forms;

 

namespace Media_Player_in_C_Sharp_By_Rohit_Programming_Zone

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

        string[] paths, files;

 

        private void btn_open_Click(object sender, EventArgs e)

        {

            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Multiselect = true;

            if(ofd.ShowDialog()==System.Windows.Forms.DialogResult.OK)

            {

                files = ofd.SafeFileNames;

                paths = ofd.FileNames;

                for(int x=0;x<files.Length;x++)

                {

                    track_list.Items.Add(files[x]);

                }

            }

        }

 

        private void track_list_SelectedIndexChanged(object sender, EventArgs e)

        {

            player.URL = paths[track_list.SelectedIndex];

            player.Ctlcontrols.play();

            lbl_msg.Text = "Playing...";

            timer1.Start();

            trackBar1.Value = 15;

            lbl_volume.Text = trackBar1.Value.ToString() + "%";

        }

 

        private void btn_play_Click(object sender, EventArgs e)

        {

            player.Ctlcontrols.play();

            lbl_msg.Text = "Playing...";

        }

 

        private void btn_pause_Click(object sender, EventArgs e)

        {

            player.Ctlcontrols.pause();

            lbl_msg.Text = "Pause";

        }

 

        private void btn_stop_Click(object sender, EventArgs e)

        {

            player.Ctlcontrols.stop();

            lbl_msg.Text = "Stop";

 

        }

 

        private void btn_next_Click(object sender, EventArgs e)

        {

            if(track_list.SelectedIndex<track_list.Items.Count-1)

            {

                track_list.SelectedIndex = track_list.SelectedIndex + 1;

            }

        }

 

        private void btn_prev_Click(object sender, EventArgs e)

        {

            if(track_list.SelectedIndex>0)

            {

                track_list.SelectedIndex = track_list.SelectedIndex - 1;

            }

        }

 

        private void timer1_Tick(object sender, EventArgs e)

        {

            if(player.playState==WMPLib.WMPPlayState.wmppsPlaying)

            {

                progressBar1.Maximum = (int)player.Ctlcontrols.currentItem.duration;

                progressBar1.Value = (int)player.Ctlcontrols.currentPosition;

 

            }

            lbl_track_start.Text = player.Ctlcontrols.currentPositionString;

            lbl_track_end.Text = player.Ctlcontrols.currentItem.durationString.ToString();

 

        }

 

        private void trackBar1_Scroll(object sender, EventArgs e)

        {

            player.settings.volume = trackBar1.Value;

            lbl_volume.Text = trackBar1.Value.ToString()+"%";

        }

 

    }

}

 

 

 ========================================================================





2 comments:

  1. Thank you.
    Please can you help with Auto play when the first music end the following automatically play

    ReplyDelete
  2. Rohit Programming Zone: Media Player In C Visual Studio By Rohit Programming Zone >>>>> Download Now

    >>>>> Download Full

    Rohit Programming Zone: Media Player In C Visual Studio By Rohit Programming Zone >>>>> Download LINK

    >>>>> Download Now

    Rohit Programming Zone: Media Player In C Visual Studio By Rohit Programming Zone >>>>> Download Full

    >>>>> Download LINK 4u

    ReplyDelete