You are not logged in.
Pages: 1
Okey, I'll try to explain my problem.
I'm currently working on a audio player, featuring a seek bar, showing the amount of the song loaded and the actual position button of the playing (think YouTube).
Now the following code I found on the net. I needed it to know where to position my position button while playing, as I can only retrieve the total bytes of the song, the bytes that are already loaded into the buffer, the length of the buffer, but NOT the total duration of the song:
loadedPercent = mySound.getBytesLoaded() / mySound.getBytesTotal() * 100;
playedPercent = mySound.currentlyPlayedMilliseconds / mySound.bufferLengthInMilliseconds * 100;
actualPercent = playedPercent * loadedPercent / 100;
myPositionButton.positionFromLeft = mySeekBar.width / 100 * actualPercent;
Now this works like a charm.
Here's the hard part (for me).
I'm including a feature so you can DRAG the position button forward or backward, within the buffered size.
As soon as I release the button, it should play at that particular position.
Can anyone tell me how to calculate the milliseconds to start playing again, bases on the position of my button ?
Thanks
Björn
Pages: 1