"get duration of file using base64 data" Code Answer's
You're definitely familiar with the best coding language Whatever that developers use to develop their projects and they get all their queries like "get duration of file using base64 data" answered properly. Developers are finding an appropriate answer about get duration of file using base64 data related to the Whatever coding language. By visiting this online portal developers get answers concerning Whatever codes question like get duration of file using base64 data. Enter your desired code related query in the search bar and get every piece of information about Whatever code related question on get duration of file using base64 data.
get duration of file using base64 data
// Create a non-dom allocated Audio element
var audio = document.createElement('audio');
// Add a change event listener to the file input
document.getElementById("fileinput").addEventListener('change', function(event){
var target = event.currentTarget;
var file = target.files[0];
var reader = new FileReader();
if (target.files && file) {
var reader = new FileReader();
reader.onload = function (e) {
audio.src = e.target.result;
audio.addEventListener('loadedmetadata', function(){
// Obtain the duration in seconds of the audio file (with milliseconds as well, a float value)
var duration = audio.duration;
// example 12.3234 seconds
console.log("The duration of the song is of: " + duration + " seconds");
// Alternatively, just display the integer value with
// parseInt(duration)
// 12 seconds
},false);
};
reader.readAsDataURL(file);
}
}, false);
Source: ourcodeworld.com
All those coders who are working on the Whatever based application and are stuck on get duration of file using base64 data can get a collection of related answers to their query. Programmers need to enter their query on get duration of file using base64 data related to Whatever code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about get duration of file using base64 data for the programmers working on Whatever code while coding their module. Coders are also allowed to rectify already present answers of get duration of file using base64 data while working on the Whatever language code. Developers can add up suggestions if they deem fit any other answer relating to "get duration of file using base64 data". Visit this developer's friendly online web community, CodeProZone, and get your queries like get duration of file using base64 data resolved professionally and stay updated to the latest Whatever updates.