Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Other JSE/JEE APIs and the fly likes JAVA Sound:How to implement seek functionality 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 » Other JSE/JEE APIs
Bookmark "JAVA Sound:How to implement seek functionality" Watch "JAVA Sound:How to implement seek functionality" New topic
Author

JAVA Sound:How to implement seek functionality

saurabh sharma
Greenhorn

Joined: Feb 15, 2007
Posts: 8
Hi,
I am trying to make a simple audio player.I am showing duration(progress) on a JSlider.But I am not able to implement when user clicks or drags the slider to new position,how to set the new position at that point.

Thanks in advance
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39578
    
  27
Welcome to JavaRanch.

Which API are you using for playing the audio?


Ping & DNS - updated with new look and Ping home screen widget
saurabh sharma
Greenhorn

Joined: Feb 15, 2007
Posts: 8
JAVA Sound API,I think it can be implemented in Clip,but as this application will be used in streaming ,so clip won't be apropriate.Right??
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39578
    
  27
Clip has getMicrosecondLength(), getMicrosecondPosition() and setMicrosecondPosition(long microseconds) methods, which seem to be exactly what you need.

I have no idea which interface would be most appropriate in your case. Doesn't Clip work?
saurabh sharma
Greenhorn

Joined: Feb 15, 2007
Posts: 8
thanks for replying ,but I think Clip is not appropriate here,as I am trying streaming ,while Clip preloads audio data instead of streaming,thats how it allows to access it at any moment.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39578
    
  27
Well, the javadocs for Clip make it clear that it can't be used for streaming data, so you may be out of luck.

Which protocol are you using for streaming the data? If it's RTP, then the JavaMedia Framework (JMF) may help. See here for further links.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JAVA Sound:How to implement seek functionality
 
Similar Threads
xsl:apply-templates select= question
Closing a dialog in Swing?
Hibernate List question
Looking at basic game design
How to seek start and end points in File?