Pergunta

I'm trying to use the mp3agic java library from within ColdFusion. Not being a java programmer (I'm mildly familiar with it), I'm a little confused. I've been able to instantiate the object and see a list of methods, but I'm not sure how to point it to a particular file.

In the examples (https://github.com/mpatric/mp3agic), they show:

Mp3File mp3file = new Mp3File("SomeMp3File.mp3");
System.out.println("Length of this mp3 is: " + mp3file.getLengthInSeconds() + " seconds");
System.out.println("Bitrate: " + mp3file.getLengthInSeconds() + " kbps " + (mp3file.isVbr() ? "(VBR)" : "(CBR)"));
System.out.println("Sample rate: " + mp3file.getSampleRate() + " Hz");
System.out.println("Has ID3v1 tag?: " + (mp3file.hasId3v1Tag() ? "YES" : "NO"));
System.out.println("Has ID3v2 tag?: " + (mp3file.hasId3v2Tag() ? "YES" : "NO"));
System.out.println("Has custom tag?: " + (mp3file.hasCustomTag() ? "YES" : "NO"));

And the first line of which is what's confusing. How, in CF terms, do I accomplish that?

Thanks!

Rob

Foi útil?

Solução

Should be something like

<cfset m = createObject("java", "path.to.Mp3File")>
<cfset m.init("path\to\your\mp3")>
<cfoutput>#m.getSampleRate()#</cfoutput>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top