javascript audio duration property returns infinity
var getDuration = function (url, next) {
var _player = new Audio(url);
_player.addEventListener("durationchange", function (e) {
if (this.duration!=Infinity) {
var duration = this.duration
_player.remove();
next(duration);
};
}, false);
_player.load();
_player.currentTime = 24*60*60; //fake big time
_player.volume = 0;
_player.play();
//waiting...
};
getDuration ('/path/to/audio/file', function (duration) {
console.log(duration);
});
Also in JavaScript:
- Accessing Nested Arrays
- import leaflet js
- javascript object get property or default
- arrow function map js
- emmet react self closing tags
- toggle jquery remove others
- javascript get duplicates in array
- document is not defined javascript in nuxt js
- in in sequelize
- js axios progress
- javascript pagination demo
- statusbar reactnati
- jquery trigger link click
- how to get selected row index of table in javascript
- parent class and add element addclass
- how get count of letters in javascript
- reverse words javascript
- jquery ajax get
- Getting Nan when calculate two date js
- kill all node server mac terminal
- ajax call to load a page on scrolling
- javascript arrays codeburst
- event exit fullscreen
- null is object in javascript