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

HTML Audio/Video DOM networkState Property

HTML Audio/Video DOM networkState Property

HTML audio/video Tag Reference HTML Audio/Video DOM Reference

Example

Get the current network state of the video:

myVid=document.getElementById("video1");

alert(myVid.networkState);

Try it »


Definition and Usage

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


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the networkState attribute.

**Note:** Internet Explorer 8 and earlier versions do not support this property.


Syntax

audio|video

.networkState

Return Value

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

    HTML audio/video Tag Reference HTML Audio/Video DOM Reference