Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account
This post has been closed. You can still view previous posts, but you can't post any new replies.

API Jukebox Support cannot play the same track more than one time

I've tried the API Jukebox Support and found that i cannot use a jukeboxtrack object to play the same track several times. On the first call, the sound plays correctly but any more call to set('playing',true) with the same track doesn't do anything. If i go to the jukebox and click on the stop button near the sound name (on top of the jukebox), the call works correctly one time, then stop working. Here is my code : track = findObjs({type: 'jukeboxtrack',title: 'SwordFight'})[0]; track.set('playing',true); In my case the wished behaviour would be to play this track, each time the track.set('playing',true) is called. I've tried track.set('playing',false); after setting it to true but the track doesn't play at all. Did i miss something ?
1442442911

Edited 1442443072
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
Try this: track = findObjs({type: 'jukeboxtrack',title: 'SwordFight'})[0];  if(track && track.get('playing') === true) {     track.set('playing',false);     setTimeout(function() {         track.set('playing',true);     }, 1000); } else if(track) {     track.set('playing',true); } else {     log("No track found") }
It works nicely, thank you for your help As a side note, when playing a new sound, the last sound replays too. I had to stop it manually or stop it in the API before playing another sound