HTML DOM Video networkState Property

HTMLWeb DevelopmentFront End Technology

The HTML DOM Video networkState property returns a number corresponding to the network state of the video.


Following is the syntax −

Returning number value


Here, the return value can be the following −

  • 0 (NETWORK_EMPTY) depicts media has not yet been initialized
  • 1 (NETWORK_IDLE) depicts media is active and has selected a resource, but is not using the network
  • 2 (NETWORK_LOADING) depicts browser is downloading media data
  • 3 (NETWORK_NO_SOURCE) depicts no media source found

Let us see an example of HTML DOM Video networkState property −


Live Demo

<!DOCTYPE html>
<title>HTML DOM Video networkState</title>
   * {
      padding: 2px;
   form {
      margin: 0 auto;
      text-align: center;
   input[type="button"] {
      border-radius: 10px;
         <video id="demo" width="320" controls><source    src="" type="video/mp4"></video><br>
         <input type="button" onclick="setTrackDetails()" value="Set Source">
         <input type="button" onclick="getTrackDetails()" value="Get Network State">
         <div id="divDisplay">
   var divDisplay = document.getElementById("divDisplay");
   var demo = document.getElementById("demo");
   var srcOfMedia = '';
   function getTrackDetails() {
      divDisplay.textContent = 'Network State: '+demo.networkState;
      function setTrackDetails() {
         demo.src = srcOfMedia;


Clicking ‘Get Network State’ button with no source defined −

Clicking ‘Get Network State’ button with source defined but browser downloading data −

Updated on 18-Feb-2021 05:30:32