YouTip LogoYouTip

Av Prop Networkstate

## HTML Audio/Video DOM networkState Property The `networkState` property returns the current network state (activity) of an audio or video element as it fetches media resource data over the network. --- ## Definition and Usage The `networkState` property is a read-only property that indicates the current connection state of the media element to the network. It helps developers understand whether the media is still loading, idle, uninitialized, or if a loading error has occurred due to a missing source. --- ## Syntax ```javascript audioOrVideoElement.networkState ``` ### Return Value The property returns an integer (Number) representing one of four possible states: | Value | Constant | Description | | :--- | :--- | :--- | | `0` | `NETWORK_EMPTY` | **Uninitialized:** The element has not yet been initialized. All attributes are in their initial states. | | `1` | `NETWORK_IDLE` | **Idle:** The media resource has been selected and is active, but the browser is currently not using the network to fetch data (e.g., it has finished loading or has buffered enough). | | `2` | `NETWORK_LOADING` | **Loading:** The browser is actively downloading media data from the network. | | `3` | `NETWORK_NO_SOURCE` | **No Source Found:** The media resource could not be loaded because no compatible source was found, or a loading error occurred. | --- ## Browser Support | Property | IE | Firefox | Opera | Chrome | Safari | | :--- | :--- | :--- | :--- | :--- | :--- | | `networkState` | Yes (9.0+)* | Yes | Yes | Yes | Yes | *\*Note: Internet Explorer 8 and earlier versions do not support the `networkState` property.* --- ## Code Examples ### Example 1: Get the Current Network State of a Video This example demonstrates how to retrieve and display the current network state of a `
← Av Prop PausedAv Prop Muted β†’