All Projects → webtor-io → platform-sdk-js

webtor-io / platform-sdk-js

Licence: MIT license
Webtor.io platform SDK for online torrent streaming

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to platform-sdk-js

Diffy
🎞️💓🍿 Love streaming - It's always best to watch a movie together ! 🤗
Stars: ✭ 37 (-2.63%)
Mutual labels:  torrent, streaming
Kawanime
Desktop app for anime fans
Stars: ✭ 396 (+942.11%)
Mutual labels:  torrent, streaming
katcr
Search in multiple torrent sites from your CLI
Stars: ✭ 65 (+71.05%)
Mutual labels:  torrent, streaming
Torrent
Full-featured BitTorrent client package and utilities
Stars: ✭ 4,138 (+10789.47%)
Mutual labels:  torrent, streaming
Confluence
Torrent client as a HTTP service
Stars: ✭ 126 (+231.58%)
Mutual labels:  torrent, streaming
Put.io Adder
OS X put.io client that acts as handler for magnet: links and .torrent files, and adds them to your put.io download queue
Stars: ✭ 172 (+352.63%)
Mutual labels:  torrent, streaming
deflix-stremio
Deflix addon for Stremio
Stars: ✭ 31 (-18.42%)
Mutual labels:  torrent, streaming
Webtorrent
⚡️ Streaming torrent client for the web
Stars: ✭ 25,554 (+67147.37%)
Mutual labels:  torrent, streaming
Enime
Desktop application for anime fans :D
Stars: ✭ 104 (+173.68%)
Mutual labels:  torrent, streaming
Streaming
r/freemediaheckyeah
Stars: ✭ 147 (+286.84%)
Mutual labels:  torrent, streaming
Vlc Bittorrent
A bittorrent plugin for VLC.
Stars: ✭ 198 (+421.05%)
Mutual labels:  torrent, streaming
streaming-pt
Live TV 📺 and Radio 📻 shell scripts from Portugal 🇵🇹.
Stars: ✭ 52 (+36.84%)
Mutual labels:  streaming
fs2-google-pubsub
Google Cloud Pub/Sub stream-based client built on top of cats-effect, fs2 and http4s.
Stars: ✭ 32 (-15.79%)
Mutual labels:  streaming
blrec
Bilibili Live Streaming Recorder 哔哩哔哩直播录制
Stars: ✭ 124 (+226.32%)
Mutual labels:  streaming
RTP-Audio-and-Video-for-the-Internet-Chinese-Version
No description or website provided.
Stars: ✭ 30 (-21.05%)
Mutual labels:  streaming
traffic
Massively real-time traffic streaming application
Stars: ✭ 25 (-34.21%)
Mutual labels:  streaming
fs2-es
Event sourcing utilities for FS2
Stars: ✭ 75 (+97.37%)
Mutual labels:  streaming
rtsp-simple-proxy
DEPRECATED - please use https://github.com/aler9/rtsp-simple-server
Stars: ✭ 41 (+7.89%)
Mutual labels:  streaming
Flood Mobile
GSoC 21' @CCExtractor. A modern mobile UI for various torrent clients with a Node.js backend and Flutter frontend.
Stars: ✭ 48 (+26.32%)
Mutual labels:  torrent
ocelot
Alternative compiled announcer (ocelot)
Stars: ✭ 14 (-63.16%)
Mutual labels:  torrent

platform-sdk-js

SDK for online torrent streaming

Features

  1. Online torrent content streaming without waiting for full download
  2. On-the-fly content transcoding
  3. Downloading torrent as ZIP-archive
  4. Subtitle transcoding, srt to vtt
  5. OpenSubtitles support
  6. Streaming of external resources (including transcoding)

Supported formats

  • Video: avi, mkv, mp4, webm, m4v
  • Audio: mp3, wav, ogg, flac, m4a
  • Images: png, gif, jpg, jpeg
  • Subtitles: srt, vtt

Prerequisites

Before moving further we must be sure that webtor backend api is already installed. Just follow this guide to setup all the things.

Installation

npm install @webtor/platform-sdk-js

or

yarn add @webtor/platform-sdk-js

Basic usage

Just a simple example of fetching torrent by magnet-uri, getting streaming url and stats:

import webtor from '@webtor/platform-sdk-js';

const sdk = webtor({
  apiUrl: '...',
});

const magnetUri = '...';

const torrent = await sdk.magnet.fetchTorrent(magnetUri);

const expire = 60*60*24;

await sdk.torrent.push(torrent, expire);

const seeder = sdk.seeder.get(torrent.infoHash);

const filePath = torrent.files[0].path;

const url = await seeder.streamUrl(filePath);
console.log(url);

// NOTE: stats will become available only after content url access
seeder.stats(filePath, (path, data) => {
  console.log(data);
});

You can find fully working example here!

Initialization

const sdk = webtor(options)

options should be the following:

{
  apiUrl: String,              // API url (required)
  apiKey: String,              // API key
  downloadUrl: String,         // All download urls will contain this location
  tokenUrl: String,            // API will get access-token from this location
  tokenRenewInterval: Number,  // Renews access-token after specific period in ms
  grpcDebug: Boolean,          // If enabled shows grpc-web debug output
  statsRetryInterval: Number,  // If stats not available for this file it will retry after specific period in ms (default=3000)
  getToken: function() Promise // If defined custom token-function will be used 
}

sdk.torrent

Provides functions for storing and retriving torrent-files.

sdk.torrent.fromUrl(url)

Fetches parsed torrent from specific url. Be sure that appropriate CORS-headers are set on server-side in case of cross-site request (Access-Control-Allow-Origin: *).

sdk.torrent.pull(infoHash)

Pulls parsed torrent by infoHash from torrent-store.

sdk.torrent.push(torrent, expire)

Pushes parsed torrent to torrent-store with specific expiration time in seconds. We can use any parsed torrent generated by parse-torrent there.

sdk.torrent.touch(torrent, expire)

Just renews expiration date of torrent-file.

sdk.magnet

Provides functions for working with magnet-urls.

sdk.magnet.fetchTorrent(magnet)

Fetches parsed torrent by magnet-uri.

sdk.seeder

Provides functions for retriving and streaming torrent-content.

const seeder = sdk.seeder.get(infoHash)

Returns seeder instance for the specific torrent stored in torrent-store.

seeder.url(path)

Returns url for original source file.

seeder.streamUrl(path, viewSettings = {})

Returns url capable for web-streaming. viewSettings should be provided only in case of content trnascoding. Possible viewSettings:

{
  a: Number,   // Selected audio channel
  s: Number,   // Selected subtitle channel
}

seeder.streamSubtitleUrl(path, viewSettings = {})

Returns subtitle-url capable for web-streaming. Can be used only for hls-transcoded content. viewSettings should be provided only in case of content trnascoding. Possible viewSettings:

{
  a: Number,   // Selected audio channel
  s: Number,   // Selected subtitle channel
}

seeder.mediaInfo(path)

Returns FFmpeg probing data. If content should not be transcoded only empty object {} will be returned.

seeder.downloadUrl(path)

Returns download url.

seeder.zipUrl(path)

Returns download url of zip-archive. Generates zip-archive of all files under directory and subdirectories specified by the path.

seeder.openSubtitles(path)

Returns object that includes all subtitles from OpenSubtitles.org. Automatically generates streaming urls for every subtitle (srt => vtt encoding).

const statClient = seeder.stats(path, function(path, data) { ... })

Receives status of specific file. Possible data:

{
  total: Number     // Number of total bytes
  completed: Number // Number of completed bytes
  peers: Number     // Total number of peers
  piecesList: []    // Array of pieces
}

Also returns instance of stat client.

statClient.close()

Closes stat client

sdk.ext

Provides functions for retriving and streaming external resources.

sdk.ext.url(url)

Returns url for original external file proxied by the api. Can resolve CORS-issues.

sdk.ext.streamUrl(url, viewSettings = {})

Same as seeder.streamUrl but for external resource.

sdk.ext.streamSubtitleUrl(url, viewSettings = {})

Same as seeder.streamSubtitleUrl but for external resource.

sdk.ext.mediaInfo(url)

Same as seeder.mediaInfo but for external resource.

sdk.ext.openSubtitles(url)

Same as seeder.openSubtitles but for external resource.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].