Question
MP3 - getStreamLength - using a virtual path help needed !
Hi to all,
I am trying to get the Stream.length of an MP3 file type but using also a virtual path that is assigned to the Vhost.XML.
After many tries i only manage to make it work only if the MP3`s are sitting inside the FMS_root_directory_applications_myMusicApp into a folder with the name "streams" wherever else i use the code that i am writing below it returns "0 seconds" as the Stream.length of every MP3.
In the main.asc i use this code :
application.onConnect = function(newClient, userObject, name){
if(userObject.userType == "Test_Music"){
newClient.virtualKey = "Music";
newClient.name = name;
newClient.getTheLength = function(streamName) {
trace("The "+streamName+" Total Time is "+Stream.length(streamName)+" : seconds");
return Stream.length(streamName);
}
}
application.acceptConnection(newClient);
}
In the Fla. file i use this to get the length:
var V_Path:String = "Music/";
var TheSound:String = "MyMp3";
var streamName:String = "mp3:"+V_Path+TheSound;
nc.call("getTheLength", { onResult: Delegate.create(this, setDuration) }, streamName);
function setDuration(nLength:Number):Void {
trace(nLength + " seconds");
}
Everything is streaming, everything works well, but i can`t get the StreamLength thou i can stream the MP3 from a virtual path
Any help would be appreciated, i have tried many times with diferent ways and nothing returns me what i need !
Thanx in advance
I am trying to get the Stream.length of an MP3 file type but using also a virtual path that is assigned to the Vhost.XML.
After many tries i only manage to make it work only if the MP3`s are sitting inside the FMS_root_directory_applications_myMusicApp into a folder with the name "streams" wherever else i use the code that i am writing below it returns "0 seconds" as the Stream.length of every MP3.
In the main.asc i use this code :
application.onConnect = function(newClient, userObject, name){
if(userObject.userType == "Test_Music"){
newClient.virtualKey = "Music";
newClient.name = name;
newClient.getTheLength = function(streamName) {
trace("The "+streamName+" Total Time is "+Stream.length(streamName)+" : seconds");
return Stream.length(streamName);
}
}
application.acceptConnection(newClient);
}
In the Fla. file i use this to get the length:
var V_Path:String = "Music/";
var TheSound:String = "MyMp3";
var streamName:String = "mp3:"+V_Path+TheSound;
nc.call("getTheLength", { onResult: Delegate.create(this, setDuration) }, streamName);
function setDuration(nLength:Number):Void {
trace(nLength + " seconds");
}
Everything is streaming, everything works well, but i can`t get the StreamLength thou i can stream the MP3 from a virtual path
Any help would be appreciated, i have tried many times with diferent ways and nothing returns me what i need !
Thanx in advance
