Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Audio networkState attribute

Audio networkState attribute

Audio Object Reference Audio object

Example

Get the current network state of the audio:

var x = document.getElementById("myAudio").networkState;

x The output value is:

1 // the audio is available and the specified resource has been selected, but the network is not used

Try it »


Definition and Usage

The networkState attribute returns the current network state (activity) of the audio.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the networkState attribute.

Note: Internet Explorer 8 or earlier browsers do not support this attribute.


Syntax

audioObject

.networkState

Return Value

Type Description
Numeric value

Represents the current network state of the audio element:

  • 0 = NETWORK_EMPTY - the audio is not initialized
  • 1 = NETWORK_IDLE - the audio is active and a resource has been selected, but the network is not used
  • 2 = NETWORK_LOADING - the browser is downloading data
  • 3 = NETWORK_NO_SOURCE - no audio source was found
  • |

    Audio Object Reference Audio object