This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes playing audio using swings extending frames Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "playing audio using swings extending frames" Watch "playing audio using swings extending frames" New topic

playing audio using swings extending frames

maze net

Joined: Feb 17, 2005
Posts: 1
i want to play an audio using the swing concept in a frame.. to get the audio file from disk, we need the URL and for that we need getDocumentBase and getCodeBase function which is present in applets.. so can anyone help me to know how to pass the URL parameters to my program... (i am trying to develope a media player like software) Thanks in advance...
Joe Ess

Joined: Oct 29, 2001
Posts: 8713

Welcome to the JavaRanch, Maze. Please change your displayed name to conform to our
naming policy. In short, your name must be a first name and last name, separated by a space and not obviously fake.
As for your question, document base and code base don't make sense in an application since there's no document (i.e. html file) loading the app. has a toURL() method which returns the URL representation of the file path, but I think you are barking up the wrong tree by using java.applet.AudioClip to play your media. The Java Media Framework API will give you the kind of functionality that people expect in a media player, like the ability to display the length of a song.

"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
I agree. Here's the link:
subject: playing audio using swings extending frames
Similar Threads
Sound not loading
Playing Audio on Web Server via Applet using JMF
can we automate any audio player using java?
reading audio metadata via JAVA API ?
JMF Audio Sample Rendering