New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@webtor/embed-sdk-js

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webtor/embed-sdk-js

Webtor.io embed SDK for online torrent streaming and download on your site

  • 0.2.19
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
13
decreased by-61.76%
Maintainers
1
Weekly downloads
 
Created
Source

embed-sdk-js

Webtor.io SDK for online torrent streaming your site

Features

  • Supports magnet-uri and external torrent-files
  • Supports video (avi, mkv, mp4, m4v) with subtitles (vtt, srt)
  • No additional plugins/extensions required

Basic usage

Generates embed for video player:

<video controls src="magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel"></video>
<script src="https://cdn.jsdelivr.net/npm/@webtor/embed-sdk-js/dist/index.min.js" charset="utf-8" async></script>

Generates embed for video player with subtitle tracks, poster, custom title and width:

<video controls src="magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel" poster="https://via.placeholder.com/150/0000FF/808080" width="100%" data-title="Sintel">
    <track srclang="en" label="test" default src="https://raw.githubusercontent.com/andreyvit/subtitle-tools/master/sample.srt">
</video>
<script src="https://cdn.jsdelivr.net/npm/@webtor/embed-sdk-js/dist/index.min.js" charset="utf-8" async></script>

Video element is replaced by wrapper div in this scenarios.

Video element attributes (streaming)

AttributeDescription
idID of wrapper div
classClass of wrapper div
widthWidth of an iframe (might be any css width value: 800px, 100%, etc... 800px by default)
heightHeight of an iframe (might be any css width value: 800px, 100%, etc... optional)
srcMagnet url or url to torrent file (required)
posterUrl to the poster image (optional)
typeUse application/x-bittorrent for torrent file url in case if it has no .torrent extension
controlsEnables all player features
data-configAdditional player configuration in JSON (see Player configuration)
data-*Set specific configuration value for a key (see Player configuration)

Advanced usage

Generates embed for video player:

    <div id="player" class="webtor" />
    <script>
        window.webtor = window.webtor || [];
        window.webtor.push({
            id: 'player',
            magnet: 'magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F',
            poster: 'https://via.placeholder.com/150/0000FF/808080',
            subtitles: [
                {
                    srclang: 'en',
                    label: 'test',
                    src: 'https://raw.githubusercontent.com/andreyvit/subtitle-tools/master/sample.srt',
                    default: true,
                }
            ],
            lang: 'en',
        });
    </script>
    <script src="https://cdn.jsdelivr.net/npm/@webtor/embed-sdk-js/dist/index.min.js" charset="utf-8" async></script>

Here is live examples

Embed configuration

AttributeDescription
idElement id where player will be embedded
magnetMagnet URI (torrentUrl ot magnet is required)
widthWidth of an iframe (might be any css width value: 800px, 100%, etc... 800px by default)
heightHeight of an iframe (might be any css width value: 800px, 100%, etc... optional)
torrentUrlUrl of the torrent-file (HTTP-server MUST include header "Access-Control-Allow-Origin: *" to allow torrent-file download on client-side)
posterUrl to the poster image (optional)
onCallback-function to capture player events (optional)
subtitlesArray of subtitles (optional, see Subtitle configuration for more details)
titleReplaces original file name in a header with specific title (optional)
imdbIdHelps to find subtitles and additional metadata (example values 'tt0133093' or '0133093' or even '133093', optional)
headerShows header with current progress and title (true/false, default: true)
pwdSelected directory in torrent (optional)
fileSelected file in torrent in selected directory (optional, by default selects first video file)
pathSelected file by full file path in torrent, can be used instead of pwd and file (optional)
langOverride ui language (optional)
userLangOverride user language (optional)
controlsEnables all features (true/false, default: true)
featuresEnables or disables specific player features (optional)
baseUrlUrl of Webtor instance (By default: https://webtor.io)

Subtitle configuration

AttributeDescription
srclangTwo-letter language code
labelSubtitle label
srcurl to the subtitle src, could be vtt, srt and m3u8. It should be direct link to subtitle.
defaultIf true this track will be selected by default (true/false, optional)

Player features

NameDescription
subtitlesEnables subtitles control
settingsEnables settings control (cog)
fullscreenEnables fullscreen control
playpauseEnables plays/pause control
currentTimeDisplays current time
timelineEnables timeline control
durationDisplays total duration
volumeEnables volume control
chromecastEnables chromecast support
embedEnables embed button

Using with your own self-hosted Webtor instance

After installing Webtor instance according to the instruction just switch baseUrl configuration attribute to your own.

Keywords

FAQs

Package last updated on 03 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc