Skip to content

Instantly share code, notes, and snippets.

@amit08255
Created September 19, 2022 07:42
Show Gist options
  • Save amit08255/ad5c118cd2d509da2fe5062bf59c5497 to your computer and use it in GitHub Desktop.
Save amit08255/ad5c118cd2d509da2fe5062bf59c5497 to your computer and use it in GitHub Desktop.
Streaming video through JioFi
  1. Login to http://jiofi.local.html
  2. Now go to WiFi Disk section and login to it.
  3. On the right side section where files are being displayed, right click -> This iframe -> Open iframe in new tab.
  4. It will open a URL like: http://jiofi.local.html/cgi-bin/en-jio-4/mSDCard.html
  5. Create a .html file with below code:
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

  <head>
   <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
   <meta name="author" content="Amin Developer!" />

   <title>Untitled 1</title>
   <script>
   function failed(e) {
     // video playback failed - show a message saying why
     const video = document.getElementById("video-player");

     console.log("failed src: ", video.src);

     if (!video.src || vide.src === "null") return;

     switch (e.target.error.code) {
       case e.target.error.MEDIA_ERR_ABORTED:
         alert('You aborted the video playback.');
         break;
       case e.target.error.MEDIA_ERR_NETWORK:
         alert('A network error caused the video download to fail part-way.');
         break;
       case e.target.error.MEDIA_ERR_DECODE:
         alert('The video playback was aborted due to a corruption problem or because the video used features your browser did not support.');
         break;
       case e.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED:
         alert('The video could not be loaded, either because the server or network failed or because the format is not supported.');
         break;
       default:
         alert('An unknown error occurred.');
         break;
     }
   }

   function onSubmit(e) {
    e.preventDefault();
    const username = "xxx";
    const password = "xxx";
    const path = "jiofi.local.html/webdav/";
    const video = document.getElementById("video-player");
    video.src = `http://${username}:${password}@${path}${e.target.url.value}`;
   }
   </script>
  </head>
  <body>

  <p><video id="video-player" src="null" type='video/x-matroska; codecs="theora, vorbis"' autoplay controls onerror="failed(event)" ></video></p>

  <form style="margin-top: 30px;width:100%;" onsubmit="onSubmit(event)">
    <label>Enter file path</label>
    <input autocomplete="off" name="url" type="text" />
    <input type="submit" value="Play" />
  </form>

  </body>
  </html>
  1. Now change username and password in .html file.
  2. Open file in Chrome browser.
  3. Enter path of video file to play (currently it's using .mkv file format). Click on play. Such as if your video is inside movies folder, then path will be like: moves/abc.mkv.
  4. If you can't get path, download file and then copy path from URL after jiofi.local.html/webdav/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment