Audio networkStateProperty

Audio 对象参考手册Audio Object

Examples

Get the current network state of the audio:

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

xThe output value is:

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

Try it Yourself »

Definition and Usage

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


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the networkState property.

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


Syntax

audioObject.networkState

Return Value

Type Description
Numeric value

Represents the current network state of the audio element:

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


Audio 对象参考手册Audio Object Other Extensions