/    Sign up×
Community /Pin to ProfileBookmark

Determine duration of EMBEDded mp3 track?

I’m not sure whether the info I need is an HTML property:value pair or a js function, so I’m posting this in both forums. When I get an answer in one I’ll note that fact in the other:

I’m using the following to play mp3 tracks the user clicks on:

<script language=”javascript”>

var title = …

document.getElementById(“forEmbed”).innerHTML=”<embed src='”+title+”‘ autostart=true loop=false volume=100 hidden=true>”;

stopPlay=window.setTimeout( “playNext()”, duration );
</script>

and it works fine.

But to use it I have to know the duration of the track. (And if the first track takes too long to load then it’s cut short.)
I’d like to revise the player to play any mp3 track, given the path/filename, without my adding further info.

Is there some way to EITHER read a value from the mp3 file OR (even better) to determine when it has stopped playing?

TIA

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @jackacohen spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...