Javascript - problem jumping to position on load

94 views
Skip to first unread message

ma...@mralston.co.uk

unread,
Feb 6, 2013, 12:46:33 PM2/6/13
to flashmp...@googlegroups.com
I'm using the Javascript version of the Flash MP3 Player and I'm having a problem with the setPosition method.

When the page loads, I want the player to jump to a position mid-way though the MP3 file and begin playing from that position (not from the start of the track).
For some reason, if I do this from the listeners onInit() event handler the setPosition call doesn't work and the player fails to jump to the specified position. If I call the setPosition method later on (for example from a button press) it works ok.

I've put together a cut down page showing problem, it's at http://www.mralston.com/mp3player_setposition_onload_problem/mp3player.html

Any ideas? Thanks.

ma...@mralston.co.uk

unread,
Feb 11, 2013, 11:35:23 AM2/11/13
to flashmp...@googlegroups.com, ma...@mralston.co.uk
Solved my own problem. The file hadn't finished loading sufficiently (so duration < requested position) when I was telling it to play. The solution was to compare the required position against the duration each time the update event fired until the file was sufficiently loaded before trying to play from that position.

txumai...@gmail.com

unread,
Aug 20, 2013, 9:33:40 AM8/20/13
to flashmp...@googlegroups.com, ma...@mralston.co.uk
No lo entiendo, tu codigo copiado a mi PC y no funciona, no play !!??
Reply all
Reply to author
Forward
0 new messages