THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Audio networkState Property

Audio Object Reference Audio Object

Example

Get the current network state of the audio:

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

The result of x could be:

1  // The audio is active and has selected a resource, but is not using the network
Try it yourself »

Definition and Usage

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


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The networkState property is supported in all major browsers.

Note: This property is not supported in Internet Explorer 8 and earlier.


Syntax

audioObject.networkState

Return Value

Type Description
Number Represents the current network state of the audio element:
  • 0 = NETWORK_EMPTY - audio has not yet been initialized
  • 1 = NETWORK_IDLE - audio is active and has selected a resource, but is not using the network
  • 2 = NETWORK_LOADING - browser is downloading data
  • 3 = NETWORK_NO_SOURCE - no audio source found

Audio Object Reference Audio Object