Player player = Manager.createPlayer(new MediaLocator(new File(con[found+1]).toURL().toExternalForm())); Time t = player.getDuration(); Double time = t.getSeconds() / 60; System.out.println(time);
getting .mp3 Duration of a JMFusing JMF to play .mp3's and need to get a song duration
Page 1 of 1
6 Replies - 9940 Views - Last Post: 06 June 2011 - 01:14 AM
#1
getting .mp3 Duration of a JMF
Posted 26 June 2009 - 09:39 PM
so far the following code will play the song i want. but wont give me an accurate time in minutes. Any help is greatly appreciated and yes i am very new to the JMF platform!
Replies To: getting .mp3 Duration of a JMF
#2
Re: getting .mp3 Duration of a JMF
Posted 26 June 2009 - 09:47 PM
painkiller102, on 26 Jun, 2009 - 08:39 PM, said:
so far the following code will play the song i want. but wont give me an accurate time in minutes. Any help is greatly appreciated and yes i am very new to the JMF platform!
Player player = Manager.createPlayer(new MediaLocator(new File(con[found+1]).toURL().toExternalForm())); Time t = player.getDuration(); Double time = t.getSeconds() / 60; System.out.println(time);
Never heard of the classes Player abd Manager where did you get them from ?
#3
Re: getting .mp3 Duration of a JMF
Posted 26 June 2009 - 09:51 PM
pbl, on 26 Jun, 2009 - 08:47 PM, said:
painkiller102, on 26 Jun, 2009 - 08:39 PM, said:
so far the following code will play the song i want. but wont give me an accurate time in minutes. Any help is greatly appreciated and yes i am very new to the JMF platform!
Player player = Manager.createPlayer(new MediaLocator(new File(con[found+1]).toURL().toExternalForm())); Time t = player.getDuration(); Double time = t.getSeconds() / 60; System.out.println(time);
Never heard of the classes Player abd Manager where did you get them from ?
they are an import from the JMF (Java Media Framework) package that you download from sun. Basically it is a big package full of media tools for playing animations, mp3's, movies etc. The import i used for the player and what not are:
import javax.media.*;
#4
Re: getting .mp3 Duration of a JMF
Posted 26 June 2009 - 10:57 PM
Hello painkiller102, I suggest you check out this link as the tutorial there includes how you can get the playback duration in microseconds and the you will have to convert it to minutes on your own, furthermore is shows you some nifty methods that could be used such the rate, audio type, name of the song/artist etc... : http://www.onjava.co...mp3.html?page=2
Hope this helps, good luck
Hope this helps, good luck
#5
Re: getting .mp3 Duration of a JMF
Posted 27 June 2009 - 07:59 AM
ayman_mastermind, on 26 Jun, 2009 - 09:57 PM, said:
Hello painkiller102, I suggest you check out this link as the tutorial there includes how you can get the playback duration in microseconds and the you will have to convert it to minutes on your own, furthermore is shows you some nifty methods that could be used such the rate, audio type, name of the song/artist etc... : http://www.onjava.co...mp3.html?page=2
Hope this helps, good luck
Hope this helps, good luck
This tutorial uses a different package, however it does have the solution to my problem! Thanks a bunch this was very helpful!
#6
Re: getting .mp3 Duration of a JMF
Posted 27 June 2009 - 08:03 AM
Quote
This tutorial uses a different package, however it does have the solution to my problem! Thanks a bunch this was very helpful!
Your welcome
#7
Re: getting .mp3 Duration of a JMF
Posted 06 June 2011 - 01:14 AM
painkiller102, on 26 June 2009 - 09:39 PM, said:
so far the following code will play the song i want. but wont give me an accurate time in minutes. Any help is greatly appreciated and yes i am very new to the JMF platform!
Player player = Manager.createPlayer(new MediaLocator(new File(con[found+1]).toURL().toExternalForm())); Time t = player.getDuration(); Double time = t.getSeconds() / 60; System.out.println(time);
though this thread is so old,i like to share my experience with this prob!!
I used createRealizedPlayer method of Manager class instead..
Player player = Manager.createRealizedPlayer(new MediaLocator(new File(con[found+1]).toURL().toExternalForm()));
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote



|