Hi Jeran,

If you feel like doing some coding, Spotify exposes a simple HTTP service 
which lets you control the player, load playlists and run pretty much any 
function. 

The node script below will start playing at 8am a playlist by its address 
and stop a 6pm. It will also loop the playlist once it ends or if the music 
is paused.

To find the address of a playlist, right click on that list in the player > 
share > copy link to clipboard.



const SpotifyWebHelper = require('spotify-web-helper');
var schedule = require('node-schedule');
const helper = SpotifyWebHelper();
const playListUrl = 
'https://open.spotify.com/user/spotify/playlist/37i9dQZEVXcTznrFTAj4JR';

helper.player.on('error', err => {
if (error.message.match(/No user logged in/)) {
console.log('User is not logged in')
} else {
console.log(err)
}
});

helper.player.on('ready', () => {

helper.player.on('end', () => { 
console.log("Repeating list...")
helper.player.play(playListUrl); 
});

helper.player.on('pause', () => { 
console.log("Resuming playback...")
helper.player.play(playListUrl); 
});

helper.player.play(playListUrl); 

});

schedule.scheduleJob('0 8 * * *', function(){ //8am
helper.player.play(playListUrl); 
});

schedule.scheduleJob('0 18 * * *', function(){ //6pm
helper.player.pause(); 
});




On Wednesday, August 23, 2017 at 11:11:54 AM UTC+10, Jeran Fraser wrote:
>
> Question for some of you technical guys/gals out there. We use music in 
> our space and currently run the music off Apple TV. We've tried Amazon 
> music, Spotify, etc. We are trying to figure out a solution to put music on 
> a timer and then pick up where it left off, i.e. ends at 6pm and starts at 
> 8am. Problem is every tablet I use and app seems to have a mind of it's own 
> and eventually the music stops and needs someone to manually put it back 
> on. Does anyone have constant music playing and if so what technology do 
> you use, i.e. app, tablets, etc. Thanks in advance! 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Coworking" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to