M
M
MaximDoshi2015-07-26 17:37:43
css
MaximDoshi, 2015-07-26 17:37:43

What event happens when the HTML5 audio player is silenced on bad internet????

The description says - waiting - occurs when the video playback is paused to load the next portion of data from a multimedia file; but it occurs only 1 time at the very beginning and that's it. How to catch an event when the player is silenced to load data?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Arthur, 2015-07-26
Mudrick @mudrick

What, really, Maxim Doshi?
Here are the events:

var events = [
    'emptied',
    'loadedmetadata',
    'loadeddata',
    'canplay',
    'canplaythrough',
    'playing',
    'ended',
    'waiting',
    'ended',
    'durationchange',
    'timeupdate',
    'play',
    'pause',
    'ratechange',
    'volumechange'
];

Hang them on the player:
_.each(events, function(type) {
    player.addEventListener(type, onEvent, false);
});

function onEvent(e) {
    console.log(e.type);
}

And then you simulate a bad connection (google it) and see what events are called.

F
Flying, 2015-07-27
@Flying

Я у себя сделал вот так: на событие timeupdate повесил обработчик который при наступлении события (и в случае если плеер играет) перезапускает отложенный вызов функции (через clearTimeout / setTimeout) в которой я запускаю отображение индикатора загрузки данных.
На мой взгляд работает как и должно.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question