How to loop MP3?
I use this to play MP3s, but it only plays once.
I want to constantly play MP3s.
/*jslint node: true, vars: true, maxerr: 50, indent: 4 */ (function (console, require, alarm) { "use strict"; var fs = require("fs"); var lame = require("lame"); var Speaker = require("speaker"); function start() { var stream = fs.createReadStream("sounds/alarm.mp3"); stream.pipe(new lame.Decoder()).pipe(new Speaker()); } alarm.start = start; }(global.console, require, exports));
Using:
Wait for the event to end with Speaker before starting a new instance.
Speaker
var speaker = new Speaker(); speaker.on('finish', start); stream.pipe(new lame.Decoder()).pipe(speaker);
Source: https://habr.com/ru/post/1482653/More articles:MS SQL 2005 - Replace null values ββwith linear interpolation - sql-serverHTML error message returned while waiting for XML - intuit-partner-platformTumblr OAuth permission "Missing or invalid oauth_verifier". message extension solution for chrome extension - javascriptThe value of the Min.value annotation attribute must be a constant expression - javaUnmarshalling multiple XML elements of the same name to a list using JAXB - javaAngular animations without ng animation, maybe? - javascriptA convenient way to validate or introspect an Ember data source with DS.RESTAdapter - ember.jsSame calculation on Linux and Windows -> different results - c ++Interpretation of Crash Magazine Crash / Stack Trace - debuggingIllustrator export for layered PSD - exportAll Articles