Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MediaElement.js - How do you set duration before playing audio?

Is there a way to preload the duration before pressing play the first time on an audio player. I know you can use { duration: 120 } which is fine if every clip is 120 seconds long. I do not have the information available in the database to dynamically populate this variable so there must be another way to tweak the MediaElement.JS script to do it.

Any thoughts anyone?

like image 869
Dave VanderWekke Avatar asked Sep 10 '12 17:09

Dave VanderWekke


1 Answers

Let the browser load the metadata by setting preload attribute.

Syntax:

<audio preload="auto|metadata|none">

http://www.w3schools.com/tags/att_audio_preload.asp

like image 133
pixelDino Avatar answered Oct 13 '22 10:10

pixelDino