Answer the question
In order to leave comments, you need to log in
How to get duration html5 audio when using mobile network before playback starts?
With a wifi connection in crome mobile and mobile Yandex browser, everything works fine, as on the desktop, you can get the duration of the audio and the current time, set currentime. If the tablet/phone is connected via mobile internet, it is not possible to obtain time information before playback starts. You can get duration and currenttime with ondurationchange, but setting currenttime will only work once. Can anyone come across? How to absolutely set currentTime when loading an audio file?
var a1 = new Audio();
a1.src = 'http://audioknigionline.ru/books/audio/Ioanna_Hmelevskaya_Bolshoyj_kusok_mira.mp3';
a1.preload = 'metadata';
a1.duration;
a1.currentTime = 10
Answer the question
In order to leave comments, you need to log in
And how can you get information about a file before you get it?
Therefore, for example, vk api, returns the duration of the audio.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question