You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When i play one song after another (...and so on) the quality gets worse.
It could be a desync between the L and R channel or something else.
it doesnt matter if i use the node-speaker or aplay player. so it looks like its the audio stream from spotify.
the code:
sidenote: i added Player.isPlaying attribute. this is just the spotify.js file. it wont run.
module.exports=function(){varlibspotify=require('libspotify');varconfig=require('../config.json');varSpeaker=require('speaker');varaudioOptions={channels: 2,bitDepth: 16,sampleRate: 44100};varself=this;this.currentList=null;this.maxTrackCount=config.maxTrackCount||12;this.search=function(data,callback){console.log('spotify search');if(!self.session){self.createSession();}varsearch=newlibspotify.Search(data);search.trackCount=self.maxTrackCount;search.execute();search.once('ready',function(){if(!search.tracks.length){console.error('there is no track to play :[');callback({error: 'there is no track to play :['});}else{self.currentList=search.tracks;callback(search.tracks);//console.log(search.tracks);}});};this.startPlayer=function(data,callback){if(self.player&&self.player.isPlaying){self.player.stop();}if(self.session){vartrack=self.currentList[data];self.player=self.session.getPlayer();self.player.load(track);self.player.play();self.player.pipe(newSpeaker(audioOptions));console.error('playing track. end in %s',track.humanDuration);self.player.once('track-end',function(){console.error('track ended');if(typeofcallback==="function"){callback();}self.player.stop();session.close();});}else{returnfalse;}};this.stopPlayer=function(){console.log('stop Player');if(self.player){self.player.stop();}};this.createSession=function(){console.log('spotify create Session');self.session=newlibspotify.Session({applicationKey: __dirname+'/../spotify_appkey.key'});self.session.login(config.credentials.login,config.credentials.password);returnself;};return{search: search,stopPlayer : stopPlayer,startPlayer : startPlayer};};
The text was updated successfully, but these errors were encountered:
Hey folks.
Great Library you're working on!
When i play one song after another (...and so on) the quality gets worse.
It could be a desync between the L and R channel or something else.
it doesnt matter if i use the node-speaker or aplay player. so it looks like its the audio stream from spotify.
the code:
sidenote: i added Player.isPlaying attribute. this is just the spotify.js file. it wont run.
The text was updated successfully, but these errors were encountered: