Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Javazoom player pause  RSS feed

 
Kasun Liyanage
Greenhorn
Posts: 23
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

Is there any way to perform a audio pause function with Javazoom's Player class?

Thanks.
 
Rob Spoor
Sheriff
Posts: 21090
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you're talking about the Player class from the Javazoom JLayer library, right? Javazoom have a few more projects.

There doesn't seem to be a pause method anywhere in the JLayer API, but you may be able to work around that. The class takes an InputStream as its constructor. Instead of making the Player pause, you could make the InputStream pause. That would require you to write your own InputStream sub class that wraps another InputStream, and has methods to pause and resume. The pausing basically means that the read methods will block until resumed. You can use several techniques for this, ranging from simple Object.wait / Object.notify / Object.notifyAll to the more abstract classes from the java.util.concurrent package.
 
Kasun Liyanage
Greenhorn
Posts: 23
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok thanks, Rob. I'll try that out.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!