I am completely stuck on how I can create an adaptive buffer for an externally loaded mp3. The code I am working with is as follows:
the sound being loaded is contained within the movieclip "soundcontrol_mc" within the main timeline of the movie.
My theory on creating a buffer would be to get the kbps of the user by applying this code:
and applying the following formula to calculate the buffer:
(1 - User bit rate / Stream bit rate) * duration of sound in seconds
However, how is it possible to calculate the duration of the media in an externally loaded mp3.
I have thought about this problem for a long while with no solution. I am beginning to doubt my skills so any help would be appreciated. Thanks in advance.
Code:
function createSoundObject(){
mySound = new Sound(soundControl_mc);
mySound.setVolume(volPercent*2);
}
createSoundObject();
mySound.loadSound ("1_beethoven.mp3", true);
the sound being loaded is contained within the movieclip "soundcontrol_mc" within the main timeline of the movie.
My theory on creating a buffer would be to get the kbps of the user by applying this code:
Code:
function getkbps(seconds,bytes){
var totalBits = bytes * 8;
var totalKBits = totalBits/1024;
var kbps = Math.round(totalKBits/seconds);
return(kbps)
}
and applying the following formula to calculate the buffer:
(1 - User bit rate / Stream bit rate) * duration of sound in seconds
However, how is it possible to calculate the duration of the media in an externally loaded mp3.
I have thought about this problem for a long while with no solution. I am beginning to doubt my skills so any help would be appreciated. Thanks in advance.