Page 1 of 1

How to play track by ID or playlist number?

Posted: Sat Feb 08, 2014 3:39 pm
by kacso
Hi, as title says I'm trying to play some track by her ID or playlist number. For now I have just found a method play into SDBPlayer class but with that method I can't choose which track will be played.
Any solution for this?

Re: How to play track by ID or playlist number?

Posted: Mon Feb 10, 2014 10:26 am
by kacso
I manage to play track using playlist number by moving track next to currently playing track then playing next track and after that returning track to her previous position BUT this works only when shuffle is off.

New question!
How to turn on/off shuffle?
For now I just now how to check if shuffle is on/off but don't now how to change that status.

Re: How to play track by ID or playlist number?

Posted: Fri Feb 21, 2014 6:33 pm
by mcow
kacso wrote:How to turn on/off shuffle?
For now I just now how to check if shuffle is on/off but don't now how to change that status.
Assuming you're looking at the state using

Code: Select all

var shuffling = SDB.Player.isShuffle
then you can set it like:

Code: Select all

SDB.Player.isShuffle = 0

Re: How to play track by ID or playlist number?

Posted: Fri Feb 21, 2014 6:40 pm
by Peke
Ok Not sure that I understand.
1. are you adding track to Now Playing and would like to start it automatically or ?
2. Can you give example where you use and need TrackID?

Re: How to play track by ID or playlist number?

Posted: Sat Feb 22, 2014 5:04 am
by kacso
@mcow
I already done that but thanks anyway...

@Peke
Well, I'm searching for some track (by track title, artist name etc.) that is in Now Playing and need to play that track and that track must finally be on the same position in Now Playing as it was before. When user get results of search he select track from list and press "Enter". From there I can get SongID and after that I can find playlist number, so for now I moving track from previous position to position right after currently playing track, then turn off shuffle (if is on) and play next track. After that I move track back to previous position.
EDIT: I now done this using: SDB.Player.CurrentSongIndex = songIndex

Re: How to play track by ID or playlist number?

Posted: Sat Feb 22, 2014 8:23 am
by Peke
That confused me as SDB.Player.CurrentSongIndex is the right way, also it should set next song or at least you will be able to use that to set correct index on OnPlay event.

Think that ZvezdanD Queue script have similar example.