• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JAVA Sound:How to implement seek functionality

 
saurabh sharma
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

Which API are you using for playing the audio?
 
saurabh sharma
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic