Giter VIP home page Giter VIP logo

Comments (3)

adarshchri avatar adarshchri commented on May 28, 2024

package.json

{
  "name": "webtor",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "browserify": "^17.0.0",
    "webtorrent": "^2.1.12"
  }
}

from browserify.

adarshchri avatar adarshchri commented on May 28, 2024

index.js

// Including modules
const WebTorrent = require("webtorrent");
// Initializing WebTorrent
const client = new WebTorrent();

// Using a magnet link
let NewMagnetTorrentId =
  "magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&tr=wss%3A%2F%2Ftracker.fastcast.nz&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F";
// Starts downloading a new torrent file
client.add(NewMagnetTorrentId, function (torrent) {
  // Using the .mp4 file
  const file = torrent.files.find(function (Newfile) {
    // Returning filename ending with .mp4
    return Newfile.name.endsWith(".mp4");
  });

  // Display the file by adding it to the DOM.
  file.appendTo("body");
});

from browserify.

adarshchri avatar adarshchri commented on May 28, 2024

index.html

<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<!-- title of the page -->
	<title>WebTorrent video player</title>
</head>

<body>
	<!-- Including script -->
	<script src="./bundle.js"></script>
</body>
</html>

from browserify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.