Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 262,967 times

Contents

Related Categories

Build an MP3 Player - Playing a File

Playing a File

Up to this point, we have yet to explain how to play an MP3 file. Believe it or not, playing the file is actually the easiest part of this process. To do so, you set the Media Player's FileName property to the file you want to play. That's all there is to it! From this point, you use the media player's built-in buttons to control playing. Listing C shows the code we created for our application.

Listing C: Opening the file

Private Sub cmdOpen_Click()
With MediaPlayer1
	If Not FileOpen Then
		.FileName = FileName
		.AutoStart = False
		cmdOpen.Caption = "Close"
	Else
		.FileName = ""
		cmdOpen.Caption = "Open"
	End If
End With
End Sub

Notice that after setting the FileName property, we chose not to have it start playing automatically, so we set the AutoStart property to False. The code in Listing A stored the currently selected file location in the FileName variable.

© 2001 Element K Journals, a division of Element K Press LLC ("Element K"). Element K and the Element K logo are trademarks of Element K LLC

Comments

  • Lyrics support

    Posted by AziMo on 07 Jan 2008

    hey there...does anyone know the way a media player with lyrics support??

     

    thanx!! 

  • Re: TW 2000

    Posted by possible181 on 03 Jun 2007

    Anyone one plz help me with mediaplayer's iserviceprovider and how to program remoting mediaplayer

  • WMP.DLL VB.net media player master

    Posted by Qwazimoto on 08 Nov 2006

    Hi people I have written a few media players and a few turned out good(most were crap thaugh).
    If any one wants any help, Id be glad to.

    My media player im working on now has the followin...

  • Re: [62] Build an MP3 Player

    Posted by KoA on 24 Oct 2006

    Can someone help me?

    First, im getting Object does not support this this methor or property on ".Filename = Filename"
    Next, im getting the same thing for for the 2 options in the timer?
    ...

  • Posted by mazdak_zp on 23 Sep 2005

    when you want to get then path of a FileListBox or DirListBox, if it returns a folder in drive it return for example "c:\windows" without "\" at the end if path. but if the path was a drive it returns...