I\'m trying to test whether a video is choppy. I have noticed that the pause
event is not triggered when the video pauses for buffering. What is the best way to det
The event you're looking for is waiting
.
From the spec:
A waiting DOM event can be fired as a result of an element that is potentially playing stopping playback due to its readyState attribute changing to a value lower than HAVE_FUTURE_DATA.
The paused
state does not change because the video is still "potentially playing" (i.e. "trying" to play). So the waiting
event fires. When enough data has been loaded, playing
fires.
You can also check the state at any time by looking at two properties, networkState and readyState
if (video.networkState === video.NETWORK_LOADING) {
// The user agent is actively trying to download data.
}
if (video.readyState < video.HAVE_FUTURE_DATA) {
// There is not enough data to keep playing from this point
}