Click here to Skip to main content
15,897,315 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everybody!

So I'm making an app which has a music player in it. I 've found this code on http://www.c-sharpcorner.com/uploadfile/e628d9/playing-audio-and-video-files-using-c-sharp/[^]. But I need to play a mp3/ wav file from /admin/admin/bin/debug/sounds/music.mp3 when I click a button without using openfiledialog. P.S admin is the project's directory.

C#
using System;
using System.Windows.Forms;

namespace mymediaplayer
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void btnBrowse_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "(mp3,wav,mp4,mov,wmv,mpg)|*.mp3;*.wav;*.mp4;*.mov;*.wmv;*.mpg|all files|*.*";
            if(openFileDialog1.ShowDialog()==DialogResult.OK)
                axWindowsMediaPlayer1.URL = openFileDialog1.FileName;
        }
    }
}


How do I set a static path (/admin/admin/bin/debug/sounds/music.mp3) for axWindowsMediaPlayer1.URL?

Thank you in advance for your help! Have a nice day!
Posted
Comments
[no name] 12-Jul-14 15:40pm    
Sorry ... what? Does axWindowsMediaPlayer1.URL = <path to your mp3 file> not work for you?
JanaRMS 13-Jul-14 3:30am    
Unfortunately, no! Frown | :( Could you give me an example when it's just mp3 file name after "axWindowsMediaPlayer1.URL = " ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900