Posts: 25
Joined: Jun 2013
Reputation:
0
I currently list all songs to a listview, when I click on a row, XBMC will play coresponding song.
But the first time I play a song, the audio player is not started.
So, How do I implement this scenario:
- if audio player is off, turn it on and play coresponding song.
- if audio player is on, just play selected song.
Thanks!
Posts: 3,077
Joined: Jun 2009
Since you don't show how you play the song hard to tell
But what you want is the standard behavior for Player.Open I guess you are playing with Playlists but need your code
Posts: 3,077
Joined: Jun 2009
... Since you post in JSON part I have already guessed that
But there's about 10 different ways to play a song so please show what you are using
Posts: 25
Joined: Jun 2013
Reputation:
0
Yeah, let me describ my app in detail:
I am developing an android app, that lists all song from XBMC (via HTTP and use JSON RPC),
In the song list, If we click on every item, my App will send request to XBMC to play that song.
My issue is, i don't know what to do when i select the first song.
Posts: 3,077
Joined: Jun 2009
What is the request you send ? I don't think this is a complicated question
Posts: 25
Joined: Jun 2013
Reputation:
0
I don't know exactly which method can be used to handle this.
I did think about Player.Open, but it requires a playlistid as parameter and there is no playlist exist!
Posts: 3,077
Joined: Jun 2009
Well I guess my question is finally complicated :p
You said you had some code that had a certain behavior, but won't show it so hard to tell what you are doing wrong ...
Anyway Player.Open does only require a playlistid if you want to play a specific item from a playlist.
To play a song you can either Player.Open with a songid or with a file.
You can also clear the audio playlist add or insert items with either the songid or the file then Player.Open the item 0 of the audio playlist.
Posts: 25
Joined: Jun 2013
Reputation:
0
Songid is the unique id of that song in whole library right?
I look at the documentation, Player.Open requires a playlistid, and there is no field named "Songid" >"<
Posts: 3,077
Joined: Jun 2009
Or perhaps you just don't know how to read the doc and use the search function in the forum
http://wiki.xbmc.org/index.php?title=JSO...layer.Open
Quote:Start playback of either the playlist with the given ID, a slideshow with the pictures from the given directory or a single file or an item from the database.
For the documentation as stated a lot in this thread and the Wiki, you should use JSONRPC.Introspect or read
https://github.com/xbmc/xbmc/blob/master....json#L111 for example.
Posts: 25
Joined: Jun 2013
Reputation:
0
Today I found out the JSON request to do what I asked in the first post,
it is: {"jsonrpc": "2.0", "id" : 1, "method": "Player.Open", "params":[{"songid":136}]}
But when it plays to the end of the song, the Player doesn't auto jump to the next song.
Plsz tell me how to implement this?!
Thanks!