How to use m3u8stream - 2 common examples

To help you get started, we’ve selected a few m3u8stream examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TudbuT / bottyclient / node_modules / ytdl-core / lib / index.js View on Github external
req = m3u8stream(format.url, {
      chunkReadahead: +info.live_chunk_readahead,
      begin: options.begin || format.live && Date.now(),
      liveBuffer: options.liveBuffer,
      requestOptions: options.requestOptions,
      parser: format.isDashMPD ? 'dash-mpd' : 'm3u8',
      id: format.itag,
    });

    req.on('progress', (segment, totalSegments) => {
      stream.emit('progress', segment.size, segment.num, totalSegments);
    });

  } else {
    if (options.begin) {
      format.url += '&begin=' + parseTime.humanStr(options.begin);
    }
    let requestOptions = Object.assign({}, options.requestOptions, {
      maxReconnects: 6,
      maxRetries: 3,
      backoff: { inc: 500, max: 10000 },
    });
    if (options.range && (options.range.start || options.range.end)) {
      requestOptions.headers = Object.assign({}, requestOptions.headers, {
        Range: `bytes=${options.range.start || '0'}-${options.range.end || ''}`
      });
    }

    req = request(format.url, requestOptions);

    req.on('response', (res) => {
      if (stream._isDestroyed) { return; }
github TudbuT / bottyclient / node_modules / ytdl-core / lib / info-extras.js View on Github external
let shortViewCount = details.shortViewCountText.simpleText;
        let rvsDetails = rvsParams.find((elem) => elem.id === details.videoId);
        if (!/^\d/.test(shortViewCount)) {
          shortViewCount = rvsDetails && rvsDetails.short_view_count_text || '';
        }
        viewCount = (/^\d/.test(viewCount) ? viewCount : shortViewCount).split(' ')[0];
        videos.push({
          id: details.videoId,
          title: details.title.simpleText,
          author: details.shortBylineText.runs[0].text,
          ucid: details.shortBylineText.runs[0].navigationEndpoint.browseEndpoint.browseId,
          author_thumbnail: details.channelThumbnail.thumbnails[0].url,
          short_view_count_text: shortViewCount.split(' ')[0],
          view_count: viewCount.replace(',', ''),
          length_seconds:  details.lengthText ?
            Math.floor(parseTime.humanStr(details.lengthText.simpleText) / 1000) :
            rvsParams && rvsParams.length_seconds + '',
          video_thumbnail: details.thumbnail.thumbnails[0].url,
        });
      } catch (err) {
        continue;
      }
    }
  }
  return videos;
};

m3u8stream

Reads segments from a m3u8 or dash playlist into a consumable stream.

MIT
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis

Popular m3u8stream functions