• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Canot play an mp3 file using Java Media Framework (JMF)

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a VOIP program wherein when an incoming call is detected my java program picks the call and makes the caller listen to an audio. The audio message file format currently supported is .wav but i need to enable .mp3 support and not .wav (However additional support for .wav wuold be a plus point though. but .mp3 is a must.)

When i give the path of the .mp3 file in the code of my java program, the call gets picked but nothing is played. The following is the output in the jmf.log with some errors. and below that is the output with .wav audio file.




**************
jmf.log output when i give the path of the .wav audio file

Can anyone help me out with this?
Thanks in advance.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you using the MP3 plugin ?
 
Krishna Komarpant
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Christophe Verré wrote:Are you using the MP3 plugin ?



Oh.. is that also required? Ok, i wil try this and check.
 
Krishna Komarpant
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi again,
No, this did not work.
I added the jar in the jre home and verified that it is included in the classpath. Still it did not work. also i tried adding the jar externally and then giving the import statement

It gives the same errors.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you check that the MP3 plugin is correctly installed by running the JavaDecoder executable, like the web page explains?
 
Krishna Komarpant
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes,
I copied the jar in the /lib/ext/ directory of the installed jre's on my system.
Closed my Java project and reopend it. I verified that the mp3 plugin was taken into the class path.

when installing the plugin, i did the following as mentioned in the website:
For the plugin to work within a JMF application, you need to :
- ensure that jmf.jar is also in the /lib/ext directory
- run the following command:
java com.sun.media.codec.audio.mp3.JavaDecoder

You should see a message that it was successfully registered, without any error message.

****And I got th success message.

Yet it did not work...
 
Krishna Komarpant
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Following is the code related to playing the audio file:



where:
1st param: the callHandle
2nd param: MediaSourceType.MEDIA_SOURCE_FILE is a constant
3rd param: absolute filename.
4th param: loop
5th param: Initial volume
6th param: Initial Gain

I hope this will help you to get an idea about the problem.
 
Krishna Komarpant
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone help me out with this? would be of great help to me.
Thanks in advance.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this code, which seems to do things a bit differently: http://www.java2s.com/Code/Java/2D-Graphics-GUI/Mediaplayer.htm
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello ,


Try this code, which seems to do things a bit differently:
http://www.java2s.com/Code/Java/2D-Graphics-GUI/Mediaplayer.htm




This is paying a .mp3 file using a Player object. Is it a right thing to say that...

JMF needs a Player object to play the .mp3 file... but does not need it for .wav files???

Is that so?


Thanks in advance
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JFM always needs a Player to play. However, for WAVE files you can also use the javax.sound packages and even java.applet.AudioClip.
 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With Plugins from Tritonous, (mp3, ogg,..) you can only use java sound api, playing, recording mp3 or other formats without the need of jmf.

http://www.tritonus.org/
 
Krishna Komarpant
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tritonous is good. :-) But if i have to implement in my code then it will make me recode everything, as the current was coded with the aim to play only wav file. Now mp3 feature is required.
At one place an output format is specified: ULAW/rtp, 8000.0 Hz, 8-bit, Mono, FrameSize=8 bits


this statement forms the format string. when i provide the wav file as an input. it works, plays and gives the following output n the jmf log:


=============================
the following is the output in the jmf.log when i give the mp3 file as the input to my application:



==================
Can anyone get a hint on this problem?



 
Sweta Mulgavker
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,

I was facing similar problems.. I made following changes


Instead of -->


I have included the following piece of code .....




These are the contents of my jmf.log




Now i am getting an error for ContentDescriptor as follows ..... (see above jmf.log file)




You can also try these changes and post if you get something....

Any help on this error will be greatly appreciated ..

Thanks and Regards...

Sweta

 
There were millions of the little blood suckers. But thanks to this tiny ad, I wasn't bitten once.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic