473,385 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Build MP3 Player without WMP OCX

hello guys im new here..hope you can help make my first project in visual basic..i want to make a mp3 player in visual basic without using the WMP OCX.. i have started i downloaded a simple mp3 player without WMP OCX and use it as a reference but since it has no tutorial i have to see the codes 1by1 i cant play my project..here's my code..

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub CmdBrowse_Click()
  3. On Error GoTo error
  4.  
  5.  With CDlg1
  6.    'On Cancel do nothing
  7.    .CancelError = True
  8.  
  9.    .DialogTitle = "Browse For MP3 Files"
  10.    .Filter = "MP3 Files (*.mp3) |*.mp3; |Wave Files (*.wav) |*.wav; |Midi Files (*.mid) |*.mid"
  11.    .ShowOpen
  12.    'Handle no filename
  13.    If Len(.FileName) = 0 Then Exit Sub
  14.  
  15.    txtFile.Text = .FileName
  16.    CmdPlay.SetFocus 'Press enter to play
  17.  End With
  18.  
  19. error:  'Do nothing
  20. End Sub
  21.  
  22. Private Sub CmdPlay_Click()
  23. Play
  24. End Sub
  25.  
  26. Private Sub TxtFile_Change()
  27. Dim Ext As String
  28. 'Check if there is a string in txtFile
  29.  If txtFile <> "" Then
  30.     'File extension is the last three letters
  31.     Ext = LCase(Right(txtFile, 4))
  32.     'If extension is supported enable player buttons
  33.     If Ext = ".mp3" Or Ext = ".wav" Or Ext = ".mid" Then
  34.       CmdPlay.Enabled = True
  35.       CmdPause.Enabled = True
  36.       CmdStop.Enabled = True
  37.       CmdRew.Enabled = True
  38.       CmdFF.Enabled = True
  39.       chkLoop.Value = 1
  40.     End If
  41.  Else
  42.     'If no file name disable player buttons
  43.     CmdPlay.Enabled = False
  44.     CmdPause.Enabled = False
  45.     CmdStop.Enabled = False
  46.     CmdRew.Enabled = False
  47.     CmdFF.Enabled = False
  48.     chkLoop.Value = 2
  49.  End If
  50. End Sub
  51.  
when i open i file i gives a error about thet command "Play" i think theres something wrong about it but in my reference player thats the only command in the CmdPlay button
Mar 11 '08 #1
14 3615
debasisdas
8,127 Expert 4TB
What is that Play in your code ?
Mar 11 '08 #2
oh your right "Play" Has no value..

how do i declare a value for play?can you kindly help me im new in visual basic..
Mar 11 '08 #3
VBWheaties
145 100+
oh your right "Play" Has no value..

how do i declare a value for play?can you kindly help me im new in visual basic..
Whats this mp3 player that you downloaded and set a reference to? Need the name of it in order to understand its code.
Mar 11 '08 #4
i downloaded this at freevbcode.com "Pocket Player" here's the code im looking at it 1by1 so i can understand how it was made..
Mar 11 '08 #5
i cant seem to post the the pocket player code..it seems that its too long so there nothing that appears in my reply..

DL link for the pocket player code
Mar 11 '08 #6
please help me with this project..how do i declare a function for play?
Mar 11 '08 #7
please help me need your answer about this
Mar 12 '08 #8
Killer42
8,435 Expert 8TB
you need to have some patience. The people who respond here are volunteering their own time, and are located in various timezones around the world.

I'd have a look at the code now, but my work system blocks access when I try to open the link. :-(
Mar 12 '08 #9
you need to have some patience. The people who respond here are volunteering their own time, and are located in various timezones around the world.

I'd have a look at the code now, but my work system blocks access when I try to open the link. :-(
oh im sorry about my impatience..im having problem posting the code here since its too long..
Mar 12 '08 #10
VBWheaties
145 100+
yep. my work also blocks. i wonder if we work at same place. :)
Mar 12 '08 #11
Killer42
8,435 Expert 8TB
yep. my work also blocks. i wonder if we work at same place. :)
I don't think it's that rare.
Mar 13 '08 #12
guys i think this the code value of "Play" i dont know which line is making it play..

Expand|Select|Wrap|Line Numbers
  1. Sub Play()
  2.  
  3. Dim CurState As Long
  4.  'check player
  5.  If Not Player Is Nothing Then
  6.     'Get the state
  7.     Player.GetState x, CurState
  8.  
  9.     If CurState = 1 Then
  10.       PausePlay
  11.       Exit Sub
  12.     End If
  13.  End If
  14.  
  15.  StartPlay 'Start playing the file
  16.  
  17. End Sub
  18. Sub StartPlay()
  19.  
  20. On Error GoTo error                   'Handle Error
  21.    'Set objects
  22.    Set Player = New FilgraphManager   'Player
  23.    Set PlayerPos = Player             'Position
  24.    Set PlayerAU = Player              'Volume
  25.  
  26.    Player.RenderFile txtFile.Text     'Load file
  27.    AdjustVolume                       'Set Volume
  28.    Player.Run                         'Run player
  29.    PlayerIsPlaying = True             'We are playing
  30.    playTimer.Enabled = True           'Start play timer
  31.    lblStatus.Caption = "Playing..."   'Status
  32.    cmdBrowse.Enabled = False          'No file open before stop
  33.    txtFile.Enabled = False            'No change
  34.    VolSlider.SetFocus                 'Remove focus from cmdPlay
  35.    i = 0                              'Animate icon
  36.    GetMP3Tags                         'Load mp3 file tags
  37.    Me.Caption = Me.Caption & " [" & txtInfo.Text & "]"
  38.  
  39. Exit Sub
  40. error:                                 'Handle error
  41.    StopPlay                            'Stop player
  42.    cmdBrowse.Enabled = True            'Enable file browser
  43.    txtFile.Enabled = True              'Enable file name text box
  44.    lblStatus.Caption = Err.Description 'Write error description to status label
  45.  
  46. End Sub
Mar 13 '08 #13
VBWheaties
145 100+
You have to set a reference to "Quartz.dll".
And according to the article, the technology (DirectShow) has been deprecated or not supported anymore.
Heres the article:
http://msdn2.microsoft.com/en-us/lib...73(VS.85).aspx
Mar 13 '08 #14
Killer42
8,435 Expert 8TB
guys i think this the code value of "Play" i dont know which line is making it play.
My money would be on line 28.
Mar 13 '08 #15

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: steve | last post by:
Sir, Unable to compile this xine player code on visual C++ on windows xp environoment is it only for Linux it is not an assignment. code downloaded from web is as follows /* * Copyright...
3
by: Kunle Odutola | last post by:
I have a database that tracks players for children's sports clubs. I have included representative DDL for this database at the end of this post. A single instance of this database supports...
3
by: Kunle Odutola | last post by:
I have a database that tracks players for children's sports clubs. I have included representative DDL for this database at the end of this post. A single instance of this database supports...
0
by: Jon Schwartz | last post by:
Hi all, I found this succint and straightforward example at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay10/mmp_sdk/simpleexampleofscriptinginawebpage.asp : <HTML>...
1
by: Shane | last post by:
I'm trying to access the media player (V10) mediacollection object from my ..NET web service to return a list of media files. For some reason when i call getByAttribute("MediaType", "Audio") ...
5
by: JulioHM | last post by:
Hi all, I'm trying to use WMP in FireFox and I have the following tag to embed the player into the html page. <EMBED TYPE="application/x-mplayer2" ...
3
by: alice | last post by:
I've been trying for a long time to figure this out, to have a page with several MP3 clips, and each one having a custom start and stop button next to them to play the track. I finally found a bit...
1
by: Ringo | last post by:
I'm trying to use windows media player in an app. I can give it an mp3 and it plays it, but if I give it a playlist it will not play and even the play button on the control is not active. ...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.