Hello every body..
u say that u want to get the duration time of WMA format, i guess that u can get the duration time of another format such as ( mov,avi,..) so please if u have method or code to get the duration time of a file to send it to me...
If there is only a way to get the duration timr of amedia with the format
hour:miniute:seconds ,,, please send it to me as fast as u can...
thanks again..
> i guess that u can get the duration time of another
> format such as ( mov,avi,..)
The JavaDocs are immensely handy, way better
than guessing, you should try consulting them.
http://java.sun.com/products/java-media/jmf/2.1.1/apidocs/index.html
http://java.sun.com/products/java-media/jmf/2.1.1/apidocs/javax/media/Duration.html
'getDuration()' - note it is used in a variety of other interfaces
Controller, Demultiplexer, Player, Processor, Track
hi shady,
this is the code which works for all type of media format other than wma..
Player player = null;
URL url;
url = new URL("file:///" + path);
//path is ur file path
player = Manager.createRealizedPlayer(url);
long timeInSeconds = (long) player.getDuration().getSeconds();
long hours, minutes, seconds;
hours = timeInSeconds / 3600;
timeInSeconds = timeInSeconds - (hours * 3600);
minutes = timeInSeconds / 60;
seconds = timeInSeconds % 60;
System.out.println("Duration of " + path + " = "
+ (hours < 10 ? "0" : "") + hours + ":"
+ (minutes < 10 ? "0" : "") + minutes + ":"
+ (seconds < 10 ? "0" : "") + seconds);
player.stop();
player.close();