File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Spring in Action this week in the Spring 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: 42267
    
  64
Welcome to JavaRanch.

Which API are you using for playing the audio?


Ping & DNS - my free Android networking tools app
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: 42267
    
  64
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: 42267
    
  64
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