N
N
noname902015-12-14 11:51:52
JavaScript
noname90, 2015-12-14 11:51:52

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

1 answer(s)
V
vovastradamus, 2015-12-14
@vovastradamus

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 question

Ask a Question

731 491 924 answers to any question