Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

index.js 684B

12345678910111213141516171819202122232425262728293031323334
  1. var player = require("./player");
  2. var httpStream = require("./http-stream");
  3. var torrentStreamer = require("./torrent-streamer");
  4. exports.httpPath = player.httpPath;
  5. var app;
  6. exports.init = function(_app, conf) {
  7. app = _app;
  8. player.init(app, conf);
  9. httpStream.init(app, conf);
  10. torrentStreamer.init(app, conf);
  11. }
  12. exports.playFile = function(path, cb) {
  13. player.play(path, cb);
  14. }
  15. exports.playTorrent = function(magnet, cb) {
  16. torrentStreamer.stream(magnet, err => {
  17. if (err)
  18. return cb(err);
  19. player.play(app.getAddress()+httpStream.httpPath, cb);
  20. });
  21. }
  22. exports.isPlaying = player.isPlaying;
  23. player.onstop = function() {
  24. torrentStreamer.stop();
  25. httpStream.stop();
  26. }