Play audio


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Play audio

  1. #1
    Join Date
    Feb 2007
    Posts
    1

    Question Play audio

    Hello im some what new with vb Im wondering how to create a just a Play and stop button and when u click play it will connect to a site like shout cast url or a listen live radio url thanks.

    If tried a sorce code example

    "
    Private Sub Form_Load()
    psSoundFile = AppPath & "http://example.com/live.wav"
    If Dir(psSoundFile) = "" Then
    MsgBox "Sample .wav file not found; can't run", , "Error"
    Else
    MMControl1.DeviceType = "WAVEAUDIO"
    MMControl1.FileName = psSoundFile
    StopWav
    End If
    End Sub
    "

    and when i click play it says wav file not found etc.

  2. #2
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    Well I guess AppPath is a variable that contains for example the media player path or some thing similar -if u don't mean "app.path" ; but in both cases if u want to run the wav file embeded in your application u souldn't put any pathes befor the url ;
    I mean [player.exe "http://file.wav"] may be a command to the player to shell it and play specified file and here the player will play separetly and not in your aplication form .
    second the function "DIR()" is checking with a local path not a network path; I mean here pathes with a "\" separator not a "/" like in url or any net-work .
    your if condition will work better if it's like that :
    If psSoundFile <> "" Then
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  3. #3
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    Sorry if your if condition is for knowing if the file exist originally in the server or not, so u may not use the "dir" and may just try to connect to the path, and if the return is FILE_EXIST u can continue and else check display the error .
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  4. #4
    Join Date
    Aug 2004
    Location
    Orange, California
    Posts
    1,263
    Try this Demo:
    Playing Sounds in VB: Demo Application
    http://www.freevbcode.com/ShowCode.Asp?ID=593

Similar Threads

  1. Creating an audio editing system
    By Neo_IRE in forum Java
    Replies: 0
    Last Post: 02-01-2007, 02:51 PM
  2. How to play an audio file?
    By yhx in forum C++
    Replies: 1
    Last Post: 01-29-2007, 07:08 AM
  3. Outputting an audio file
    By srekcus in forum Java
    Replies: 0
    Last Post: 08-16-2006, 06:42 PM
  4. onmouseover audio
    By Joe in forum Web
    Replies: 0
    Last Post: 09-30-2001, 11:17 PM
  5. New Target Window for link and automatic Play Real Player
    By Sohail in forum Architecture and Design
    Replies: 0
    Last Post: 01-15-2001, 11:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center