igpapi — Instagram private API Simulator for Node.js (API reference) 4.14.0
    Preparing search index...

    Function DownloadReelSong

    • Internal

      Downloads the part of the song a Reel needs, the way the app's player does, and returns it as one fragmented MP4: the initialization segment followed by the fragments from the one the start lies in to the one the clip ends in, each with its own timestamps (so the song's timeline is the song's, and the file is decodable from the start by timestamp).

      The requests, in the app's order and with the app's values:

      1. the initialization and the segment index in one range;
      2. while previewing, the first fragment;
      3. the fragment the start lies in (its etd_ms is absent: the player is not yet playing);
      4. one fragment after another. The player plays from the start in real time, and etd_ms is the song buffered ahead of the playback position when the chunk is requested; the buffer loads below HIGH_BUFFER_MS and, once full, waits until playback drains it below LOW_BUFFER_MS, so the downloads come in pairs about 4 s apart and the whole download takes about as long as the clip minus the buffer.

      Parameters

      Returns Effect<
          Buffer<ArrayBuffer>,

              | IgApiError
              | RequestError
              | ParseError
              | TransportError
              | ReelSongDownloadError,
          MobileHttpRequest
          | PlainApiHeaders,
      >