You are on page 1of 12

Search - Articles - Dev Forums - Favorites - Member Login

Update and upgrade without downtime. Think in Windows Azure. From Microsoft. Try it for free now
Home Dev Articles Sample Chapters Dev Forum Directory Feed Add a Listing Link to us Contact

How to Create Media Player in VB.NET


Author: DevASP Download Source Code : 304_Media Player.zip This article will guide you through the complete process of creating a media player just like in Windows Operating System (OS) by using Active X control provided by .NET Framework.

DevASP Weekly News Letter: Your Name: Email Address:

Dev Articles
ASP.NET (338) C# (300) SQL Server (53) VB.NET (195) Web Services (2)

Search Directory

Steps you will have to do. Start visual studio and create a new window application project. Set the following properties of Form by using properties windows.

ASP.Net AJAX Text = Media Player, BoarderStyle = FixedSingle, maximizeBox = False, Size = 298,298 AJAX ToolKit .NET Namespaces Applications Now right click on the toolbar and from the menu choose Add/Remove Items. A dialog box will appear choose the COM Component Articles & Samples tab. Search for windows media player and check it by clicking in the checkbox. Click ok. Now in your toolbox a new item is added with Assembly & Controls the name of window media player. Community Developer Sites Downloads Drop this to your form and set the following properties. Hosting Services Introduction Name = player, Size = 298,250 Knowledge Base Sample Chapters WebCasts

ASP.NET
Applications Articles & Samples ASP.Net Sites Assembly & Controls Downloads Errors & Bugs Introduction Knowledge Base Sample Chapters WebCasts

Drop a main menu control to build the menu for media player Build the menu in the following hierarchy and set there names as shown in parenthesis.

File Open (open) Exit (mexit) Player Play (play) Stop (mstop) Pause (mpause) Volume Up (mup) Down (mdown) Mute (mmute) From toolbox drop a OpenFileDialogBox control to your form. Set its name to opd. Open the code window and write the code as below in your code window. Private Sub open_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles open.Click Try opd.InitialDirectory = "c:\" opd.ShowDialog() player.URL = opd.FileName player.Ctlcontrols.play() Catch ex As Exception MessageBox.Show("Some error occur so can't play media", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try

VB.Net
Articles & Samples Downloads Errors, Bugs & Fixes Introduction Knowledge Base Sample Chapters WebCasts

C-Sharp
Applications Articles & Samples C-Sharp Sites Errors, Bugs & Fixes Introduction Knowledge Base Sample Chapters WebCasts

SQL Server End Sub


Applications Articles & Samples SQL Sites Downloads Errors, Bugs & Fixes Introduction

Private Sub mexit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mexit.Click

converted by Web2PDFConvert.com

Introduction Knowledge Base Sample Chapters WebCasts

Application.Exit() End Sub Private Sub play_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles play.Click player.Ctlcontrols.play() End Sub Private Sub mstop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mstop.Click player.Ctlcontrols.stop() End Sub Private Sub mpause_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mpause.Click player.Ctlcontrols.pause() End Sub Private Sub mup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mup.Click player.settings.volume = player.settings.volume + 10 End Sub Private Sub mdown_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mdown.Click player.settings.volume = player.settings.volume - 10 End Sub Private Sub mmute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mmute.Click If player.settings.volume = player.settings.mute() Then player.settings.volume = 20 Else player.settings.volume = player.settings.mute() End If End Sub

Article Comments
chandni Gupta

This really a very good Programm and very easy to make


Posted on 5/28/2006 5:56:37 AM by chandni Gupta

jon

hi i have made the media player however when i search files it comes up will all files i just want the mp3,wave and files like them to come up.(ones that only play in windows media player). Can you please tell me the code so that my media player will work better. thanks
Posted on 12/12/2006 11:47:24 AM by jon

manu krishnan G

very simple to create and test and understand


Posted on 12/13/2006 1:08:36 AM by manu krishnan G

nagaraju

its nice and ammazing for me and it is very easly understandble code
Posted on 12/30/2006 3:21:24 AM by nagaraju

converted by Web2PDFConvert.com

nobthi

Hii may i know with what thing you made media player did you made with Visula study 2003 thank you and are those the code that you made with thank you very much
Posted on 1/9/2007 8:54:49 PM by nobthi

manisha

The article is realy good. In this code u are passing url that is perticular file name. supose i want to pass perticular ip address and port number then what changes i shoule do? can u reply please.
Posted on 1/22/2007 5:49:07 AM by manisha

D Prasad

This is Very easy to understand and easy to create. nice.


Posted on 1/23/2007 5:45:48 AM by D Prasad

Rupinder

I want to give the functionality of Forwarding the Songh and Revinding it....Cn u plz help me
Posted on 1/26/2007 2:21:14 AM by Rupinder

sujaneesh

Hi This article is excellent, for beginners.Thank you very much.


Posted on 3/8/2007 2:36:24 AM by sujaneesh

hardik

i want to require coding for simple player make i vb.net


Posted on 3/8/2007 11:40:45 PM by hardik

keerthy

I want to play the .wmv file from a specified position in windows media player using vb.net, if any one knows please help.
Posted on 3/9/2007 7:04:49 AM by keerthy

vinay kumar goud

The article is good. In this code i want to play .mpeg4 or .AVI files in this media player pl help me in this coding.
Posted on 3/19/2007 1:55:26 AM by vinay kumar goud

chlc1966

How can I retrieve a video from a ORDVideo data type stored in an Oracle database? I would like to have a very simple windows application with a button (Open video), an instance of WMP. I know that I can't stream the video because I am using Windows 2003 Server (I am using XP) in my laptop. How can I re-build the file stored in my database so I can pass the file name to WMP?
Posted on 3/26/2007 4:52:59 PM by chlc1966

Carlos Henrique

Now how can I create a media player in ASP.Net I am working on my laptop which has Windows XP home edition, but the service is automatically installed with Visual studio, so I just would like to know how to create the enviroment to retrieve the video on the Web
Posted on 4/9/2007 1:36:23 AM by Carlos Henrique

KUY CHANTHA

I am so interested in your website especially about making karaoke by using source code of vb.net. Please could you recommend me about this?

converted by Web2PDFConvert.com

Posted on 5/4/2007 11:32:56 PM by KUY CHANTHA

makilya

your code is simple and easy to understand.am proud I managed to create my own media player. thank you
Posted on 5/10/2007 3:35:53 AM by makilya

vibhor

it is really a nice coding and very easy to understand


Posted on 5/28/2007 12:44:39 AM by vibhor

Sean Thompson

I was making a media player that played songs off a server, that allowed you to skip tracks etc. The idea was that if i run the program @ college i can play any song i upload to my server. catch is they all have to name 1.mp3, 2.mp3 etc. but if any1 is interested email/msn me @ heatproofsean@hotmail.co.uk heres the program so far (its still under progress when this was submitted)
Posted on 5/28/2007 9:27:35 PM by Sean Thompson

Adro

Hi. Very nice code. But, how to add video player functions to it?
Posted on 6/4/2007 11:28:34 AM by Adro

Richard Bishop

Very nice. But, what does it mean if the Windows Media control comes up in the toolbox as 'disabled' ??

Posted on 6/8/2007 12:49:43 PM by Richard Bishop

Sharfudeen

Superb..! Easy to understand for beginners... Thanks a lot...!


Posted on 7/28/2007 11:53:17 AM by Sharfudeen

Eric

Hi, I just don't know what to say. This article has helped me a lot. Please do keep up the good work.
Posted on 8/6/2007 11:34:08 PM by Eric

lalit

send me media player in resarch level project


Posted on 9/5/2007 5:17:29 AM by lalit

Partha Chatterjee

source code of media player with example

Source code of crystal report with example


Posted on 10/3/2007 2:15:33 AM by Partha Chatterjee

bongani

Very simple code but there is no code for the previous,next buttons and the play list.
Posted on 10/17/2007 9:41:46 AM by bongani

Krs

where bouts do i enter the code, sorry, im a total noob.


converted by Web2PDFConvert.com

Thanks Kris
Posted on 10/28/2007 6:14:44 PM by Krs

hisham

to forward: player.Ctlcontrols.fastForward -----------------------------------another method to forward: player.Ctlcontrols.currentPosition += 10 =========================== to go to specific time: player.Ctlcontrols.currentPosition = 10
Posted on 11/9/2007 11:02:04 AM by hisham

lalit

How i read the songs lyrics when songs play that lyrics alos will be shown in front of audio or vedio player.
Posted on 12/7/2007 10:19:15 AM by lalit

bhushan puranik

i have disgined wavw file player which plays wave files stored on my pc as per my selection. Can I play *.mp3 extension files in vb.net?
Posted on 12/22/2007 9:06:30 AM by bhushan puranik

krishnadas

I want to know how we can create media player by using vb.net with examples.
Posted on 12/26/2007 11:07:18 PM by krishnadas

krishnadas

I want to know how we can create media player by using vb.net with examples.
Posted on 12/26/2007 11:07:20 PM by krishnadas

krishnadas

I want to know how we can create media player by using vb.net with examples.
Posted on 12/26/2007 11:07:24 PM by krishnadas

shadi

I can't clear understand this code can you explain more than
Posted on 1/6/2008 1:24:46 AM by shadi

farooq

thank u very much, it make my work very easy


Posted on 1/10/2008 5:18:30 AM by farooq

Rahul

i want to pass specific ip address and port number then what changes i should do?
Posted on 1/25/2008 5:40:03 AM by Rahul

joske vermeulen

jeah ! i was looking for that for a while !!! really simple to make and to understand
Posted on 1/27/2008 5:21:28 AM by joske vermeulen

converted by Web2PDFConvert.com

jos.

can i do the same with files in the recources ???


Posted on 1/27/2008 5:22:00 AM by jos.

vishal verma

This really a very good Programm


Posted on 2/15/2008 5:20:43 AM by vishal verma

vishal verma

This really a very good Programm


Posted on 2/15/2008 5:31:08 AM by vishal verma

Masroor Aijaz

Good Work...
Posted on 3/15/2008 11:11:50 PM by Masroor Aijaz

Asif

Thank you
Posted on 4/9/2008 12:36:06 AM by Asif

CJ

Great coding. I've recently wanted to begin creating my own media player and this is what I was looking for. Thanks for the code. I now have the player working and will be able to continue to add to it...
Posted on 5/19/2008 3:37:03 PM by CJ

gautam

thanks lord
Posted on 5/21/2008 6:34:01 AM by gautam

rahul namdev

Great job, can you please tell me how to play .3gp or some other extention with this player?
Posted on 8/15/2008 2:59:31 AM by rahul namdev

Rehan Qureshi

Thanx for give me useful informations. I hope further about this article in future and solve my problems .................
Posted on 8/15/2008 4:25:18 AM by Rehan Qureshi

Nazmul Hasan

Thank you vary much.


Posted on 10/28/2008 7:43:59 AM by Nazmul Hasan

Vivek

i have got many more idea about how to make media player. its really nice
Posted on 11/18/2008 4:34:46 AM by Vivek

vasdev

Hi, I need to add logo in my video file in this video file is separate & my logo is separate how can in mix this two separate file using VB

converted by Web2PDFConvert.com

it can bee possible can you send how it is possible Thanks with regrad A.vasdev
Posted on 11/22/2008 4:28:38 AM by vasdev

pronob saha

its working but how i will access multimle video or audio files in playlist which will play one by one can u give some idea? please reply me.
Posted on 2/2/2009 4:23:03 AM by pronob saha

anas

thanks 4 ur web ................. details


Posted on 7/30/2009 4:16:46 AM by anas

yogesh

itz good to read your codes sir, i felt satisfied after studying codes related to media player........ plz tell me how to create an option of Converting one format into another in an application as a control..........i would be your greatful....
Posted on 8/7/2009 9:08:55 AM by yogesh

manz

can anyone help me.. im looking for code to send audio to different sound cards.. eg. i want to play audio1 through soundcard1 at the same time as audio2 is playing through soundcard2.. this is using different tabs in my media player.. i would be grateful for any help or ideas.. m4nz.uh@googlemail.com thanks in advance manz
Posted on 11/19/2009 7:47:16 PM by manz

prashant punia

vry simple coding and understand properly


Posted on 12/21/2009 4:36:01 AM by prashant punia

prashant punia

vry simple coding and understand properly. sir how how can convert file for mp3 to wave file and play d media player........how?
Posted on 12/21/2009 4:39:32 AM by prashant punia

Greaseddog

How do i make a custom timebar for my media player? Using progressbar or something!
Posted on 12/31/2009 6:56:16 AM by Greaseddog

shankar

1.The media player in vb.net which tool we have use and how to identified the tool in the references. 2.can we use the control any one of the toolbox.Then which controls we use.
Posted on 1/6/2010 11:32:58 PM by shankar

converted by Web2PDFConvert.com

John

The player worked very well but my worry is, the quality of the output was not all that good as compared to the Windows Media Player and other players. How can I overcome this problen. Can someone help please.
Posted on 1/14/2010 9:33:53 AM by John

Pradeep

I am trying to do following but not getting it . Please help "I want to resize my player .It means if we strech window then display window should also gt streched" I tried this command "Me.Size.Equals(player.Size)" But not getting solution. Please help me.
Posted on 1/14/2010 1:41:49 PM by Pradeep

sanjay saurav

its really nice code .............


Posted on 1/20/2010 4:52:41 AM by sanjay saurav

Ringo david

How can i make a 2D game using vb .net 2008?


Posted on 1/22/2010 5:50:44 AM by Ringo david

gunnsi

"Handles clause requires a WithEvents variable defined in the containing type or one of its base types" I get this error in every "Private Sub mmute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mmute.Click" can any1 plz help me and show a solution ?
Posted on 2/1/2010 12:14:56 PM by gunnsi

gangstaa

thnx for supporting


Posted on 2/7/2010 1:23:11 AM by gangstaa

hush

hey. thank you so much. i was planning to make a gift for my boyfriend using vb.net. and i'll put all of our songs in it. you helped me big time. ^^
Posted on 2/10/2010 1:47:06 AM by hush

shrawan singh

how can i next and prev the tracks ???


Posted on 2/13/2010 1:47:26 AM by shrawan singh

Manoj

This is very helpful article for me and my mates Thanks for Sharing
Posted on 2/19/2010 4:26:13 AM by Manoj

shailaja

its really nice code... how can i add timer in this code so that media should play for some seconds and then stop..then after some time it should start again.. thanks in advance..
Posted on 2/23/2010 1:28:07 AM by shailaja

kedar

I want to create media player which is play all file format i.e audio,video file (.vob ,.amr,.mp4, etc...). How create condition for all types.

converted by Web2PDFConvert.com

plz help me !!!


Posted on 2/27/2010 1:10:53 AM by kedar

samson

yeah! it is really valuable information to all of us who want to know these details....thank you very much.....
Posted on 3/5/2010 1:13:11 AM by samson

shakir

it is very useful for me. thanks for this .can u help me more to connect oracle database from vb.net
Posted on 3/5/2010 6:04:37 AM by shakir

goldengel

Hi. I just knew it was not very difficult. But I really hoped that somewhere is any easy to understand information HOW TO use it in basics. Thanks a lot for your sample.
Posted on 3/5/2010 8:41:10 PM by goldengel

Arun

It's very easy understand and works perfectly. Thanks.


Posted on 3/10/2010 1:54:55 AM by Arun

kusumsiri

this is a very useful and nice article to help me for mamaking a media player using vb.net
Posted on 3/14/2010 6:42:37 AM by kusumsiri

sanjubaba

I feel it vary understandable code but how to let the music files or collection to media player list
Posted on 3/23/2010 3:01:27 AM by sanjubaba

VBfreak

im confused but the codes are correct???? but if you wanna be a pro do it from scrach like i do i can make the COM Component by myself its much easyr im a c++/cvb2008 FREAK soory im very picky with my codes. and once i deleted framework by accident
Posted on 4/6/2010 5:57:43 PM by VBfreak

sudhir

how excellent this code is ! i can't describe . it has solved my problem very easily
Posted on 4/11/2010 4:42:19 AM by sudhir

arpan

the code is very easy but i can't add player on this way.. plz somebody help me
Posted on 4/22/2010 2:32:40 AM by arpan

deep

hi i try this code in c# but i there is confusion in open menu; there is not work open directory and not able to select file. tell me please what i do to select file as click on "open"..... i wait for ur ans.
Posted on 4/30/2010 6:54:58 AM by deep

Rajan

Thanks for this code

converted by Web2PDFConvert.com

Posted on 5/10/2010 1:21:11 AM by Rajan

puva

its easy to understand..thank you...but can i know how to do next & prev button??? and also how to make the song A change to song B by ownself after song A finish???
Posted on 5/17/2010 4:45:06 AM by puva

flavian mayro xavier

it would like to know as I make to show a video in full screen but at the beginning of the video it could not appear the bar of commands (play, volume) in low of the video!
Posted on 5/26/2010 10:33:47 AM by flavian mayro xavier

bier

Thank you verry much


Posted on 6/9/2010 6:17:43 AM by bier

bharat patel

media plarer codding in vb.net


Posted on 6/25/2010 3:14:27 AM by bharat patel

Samuel Sesay

please help me wit vb.net code to make media player.


Posted on 6/29/2010 12:05:23 PM by Samuel Sesay

sivaraj

its very useful to me.., esy to understand also thank you vry much...
Posted on 7/1/2010 7:53:50 AM by sivaraj

How to Create Media Player in c#.NET

plz it is urgent
Posted on 7/2/2010 10:29:32 AM by How to Create Media Player in c#.NET

aung ko

Thanks its very helpful for me


Posted on 7/6/2010 12:58:59 AM by aung ko

ud2008

How can I use a progressbar to see the progress of a song or video and be able to scroll through the media (like in windows media player).
Posted on 7/6/2010 8:25:06 AM by ud2008

vikas

Thanks.....
Posted on 7/15/2010 2:17:11 AM by vikas

moen

wow its so good to program in vb am doing project on online information system but how to do it
Posted on 8/1/2010 11:01:19 AM by moen

ankit

It is very good............ very easy to make media player with the help of it...... but it only import windows media player....... i want to make new media player......
converted by Web2PDFConvert.com

plz give idea......


Posted on 8/13/2010 1:26:59 PM by ankit

sparsh

actually i have yet not tried ,but i hope that i will success.....
Posted on 8/19/2010 10:54:59 AM by sparsh

sanjeev kumar

this is working and i hope this work very well


Posted on 8/21/2010 2:01:22 PM by sanjeev kumar

saravanan b

it's very useful to me ....... i searched this for long time thank u very much
Posted on 8/23/2010 1:38:26 PM by saravanan b

ganesh yadav

sir, it is really good it's work well :)


Posted on 8/27/2010 6:51:49 AM by ganesh yadav

srilekha

hiiiiiiiii the code was to gud am unable 2 play all the video files can u plz send me the code which i can play any of the files in it.
Posted on 10/30/2010 12:38:41 AM by srilekha

mm gehlot

Thanks for providing code, it's very easy.


Posted on 11/1/2010 3:05:37 AM by mm gehlot

YangoT ech

Thank you very much for these simple, well understood, easy to read, excellent and wonderful codes. I really appreciate it.
Posted on 11/1/2010 10:52:08 PM by YangoT ech

Lusubilo Mwakibinga

this is real good 2 me! thnx


Posted on 11/3/2010 4:21:04 AM by Lusubilo Mwakibinga

raj verma

its very good program it is very simple and easy to make nice coding..thanks But could me send the coding of text to voice converter plzzz. Its very urgent i m waiting.............
Posted on 11/16/2010 12:36:11 AM by raj verma

louie jay

thanks for the code!! it's been great help to me!!!


Posted on 12/1/2010 2:55:21 AM by louie jay

Add Article Comment:


Name : Email Address :
converted by Web2PDFConvert.com

Email Address : Comments :

Send me an email about this article when other users post a Comment Submit Clear All

<< Creating Print Screen Function using Windows APIs How T o Disable Close Button in Windows Form >>
Disclaimer - Privacy 2002-2010 DevASP .net

converted by Web2PDFConvert.com

You might also like