Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Problem stopping a Player in JMF

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recently moved from Javas built in sound API to JMF. As I'm using an old JVM (1.4) and only interested in playing WAV files, JMF was a perfect solution and has greatly simplified the code to load, play and control the volume of audio clips in my application.

But I'm having trouble stopping the clips on demand. It would seem as simple as calling player.stop(), but stop() seems to block until the player has finished playing. Here is a simple code example:



This produces output like:



where I would have expected the second time to read equal to or only briefly later than the first. (Or perhaps to have been reset to 0 or something.) I have also tried p.setStopTime( p.getMediaTime() ). This stops the clip on time, but plays a split second of distortion before stopping, which is undesirable.

Googling around makes me think that others aren't having this issue, and it's been kind of hard to find options. Could this be a buffering issue or am I missing something else? Any insight you can provide is greatly appreciated.

I am using (and cannot change) JVM 1.4.2 with JMF 2.1.1. All of my WAV files are only 1-10 seconds long.

Thanks, Clayton
 
Clayton Carter
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I ended up fixing this; it was indeed related to buffering. I have posted a detailed description of my fix over at Stack Overflow:

Ploblem Stopping a Player in JMF at Stack Overflow

Clayton
 
I knew that guy would be trouble! Thanks tiny ad!
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic