Unable to stream song, for sample 30sec. "Unable to get stream URL"

39 views
Skip to first unread message

Punith Raj

unread,
Apr 13, 2015, 7:58:08 AM4/13/15
to rdio...@googlegroups.com
Dear Team,


I am working on creating a application which uses Rdio android sdk. I have setup my project as explained in the support page. I am not able to get 30 sec song stream working. I have tested for other api calls and they do work. Below is my configuration.

A static Rdio object, initialized only once.

rdio = new Rdio(PartyConstants.accessToken, PartyConstants.accessTokenSecret, accessToken, accessSecret, this, this);

PartyConstants.accessToken  and PartyConstants.accessTokenSecret is my credentials accessToken and Secret.
accessToken and
accessSecret is retrieved after successfull login --> saved later in shared preferences.


On my play button, i am creating a new async task to create a new media player and start a song.

public void playButton(int position) {
       
       
String _songId = songList.get(position).getTrackID();

       
AsyncTask<String, Void, String> task = new AsyncTask<String, Void, String>() {
           
MediaPlayer player;

           
@Override
           
protected String doInBackground(String... params) {
               
String trackId = params[0];
               
try {
                    player
= rdio.getPlayerForTrack(trackId, null, true);
                   
player.prepare();
                    player
.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
                       
@Override
                       
public void onCompletion(MediaPlayer mp) {
                           
//TODO
                       
}
                   
});
                    player
.start();
               
} catch (Exception e) {
                   
Log.e("Test", "Exception " + e);
               
}
               
return trackId;
           
}
       
};
        task
.execute(_songId);
   
}



once the thread enters the
prepare method, its running in there forever whithout exception or return.
Below is the stack trace. rdiop...@gmail.com is my id, if it matters.




-------------------------STACK TRACE-------------------------------------------------------------------

04-13 07:42:14.381  12178-12201/com.bosch.partyapplication I/RdioAPI Instantiated connection for sr33382100. Read size 131072. Initial byte position 0
04-13 07:42:14.395  12178-12222/com.bosch.partyapplication I/RdioAPI Thread starting
04-13 07:42:14.395  12178-12222/com.bosch.partyapplication I/RdioAPI Starting buffer for song sr33382100
04-13 07:42:14.395  12178-12222/com.bosch.partyapplication I/RdioAPI Connecting sr33382100 type: aac-high,mp3-high
04-13 07:42:15.069  12178-12222/com.bosch.partyapplication W/RdioAPI Unable to get stream URL: java.lang.Exception: Rdio could not get track playback info
04-13 07:42:15.069  12178-12222/com.bosch.partyapplication E/RdioAPI Exception in first connect
    java
.io.IOException: Could not find stream URL
            at com
.rdio.android.api.internal.n.a(Unknown Source)
            at com
.rdio.android.api.internal.n.d(Unknown Source)
            at com
.rdio.android.api.internal.n.run(Unknown Source)
            at java
.lang.Thread.run(Thread.java:818)
04-13 07:42:15.069  12178-12222/com.bosch.partyapplication E/RdioAPI Exception in readahead thread
    java
.lang.NullPointerException: Attempt to invoke virtual method 'int java.io.InputStream.read(byte[], int, int)' on a null object reference
            at com
.rdio.android.api.internal.n.run(Unknown Source)
            at java
.lang.Thread.run(Thread.java:818)
04-13 07:42:15.069  12178-12222/com.bosch.partyapplication I/RdioAPI Connecting sr33382100 type: aac-high,mp3-high
04-13 07:42:15.096  12178-12226/com.bosch.partyapplication V/RdioAPI New connection thread
04-13 07:42:15.097  12178-12226/com.bosch.partyapplication V/RdioAPI Request Header: User-Agent = stagefright/1.2 (Linux;Android 5.0.1)
04-13 07:42:15.097  12178-12226/com.bosch.partyapplication V/RdioAPI Request Header: Host = 127.0.0.1:40898
04-13 07:42:15.097  12178-12226/com.bosch.partyapplication V/RdioAPI Request Header: Connection = Keep-Alive
04-13 07:42:15.097  12178-12226/com.bosch.partyapplication V/RdioAPI Request Header: Accept-Encoding = gzip
04-13 07:42:15.097  12178-12226/com.bosch.partyapplication V/RdioAPI ContentServer opening connection with starting offset 0
04-13 07:42:15.097  12178-12226/com.bosch.partyapplication V/RdioAPI Created HttpStreamEntity using prepared connection
04-13 07:42:15.097  12178-12226/com.bosch.partyapplication V/RdioAPI forcing chunked
04-13 07:42:15.098  12178-12226/com.bosch.partyapplication V/RdioAPI Getting stream
04-13 07:42:15.098  12178-12226/com.bosch.partyapplication I/RdioAPI Content length is -1
04-13 07:42:15.098  12178-12226/com.bosch.partyapplication I/RdioAPI Content length is -1
04-13 07:42:15.098  12178-12226/com.bosch.partyapplication I/RdioAPI Content length is -1
04-13 07:42:15.812  12178-12222/com.bosch.partyapplication W/RdioAPI Unable to get stream URL: java.lang.Exception: Rdio could not get track playback info
04-13 07:42:15.813  12178-12222/com.bosch.partyapplication W/RdioAPI Failed to reconnect, retrying soon. Exception: java.io.IOException: Could not find stream URL
04-13 07:42:15.813  12178-12222/com.bosch.partyapplication I/RdioAPI Connecting sr33382100 type: aac-high,mp3-high
04-13 07:42:16.517  12178-12222/com.bosch.partyapplication W/RdioAPI Unable to get stream URL: java.lang.Exception: Rdio could not get track playback info
04-13 07:42:16.517  12178-12222/com.bosch.partyapplication W/RdioAPI Failed to reconnect, retrying soon. Exception: java.io.IOException: Could not find stream URL
04-13 07:42:16.518  12178-12222/com.bosch.partyapplication I/RdioAPI Connecting sr33382100 type: aac-high,mp3-high
04-13 07:42:17.240  12178-12222/com.bosch.partyapplication W/RdioAPI Unable to get stream URL: java.lang.Exception: Rdio could not get track playback info
04-13 07:42:17.240  12178-12222/com.bosch.partyapplication W/RdioAPI Failed to reconnect, retrying soon. Exception: java.io.IOException: Could not find stream URL
04-13 07:42:17.240  12178-12222/com.bosch.partyapplication I/RdioAPI Connecting sr33382100 type: aac-high,mp3-high
04-13 07:42:17.958  12178-12222/com.bosch.partyapplication W/RdioAPI Unable to get stream URL: java.lang.Exception: Rdio could not get track playback info


Regards
Punith

Punith Raj

unread,
Apr 14, 2015, 9:37:45 AM4/14/15
to rdio...@googlegroups.com
So i figured out one mistake in the previous code.. i was passing a type : "sr" sr33382100 to the method getPlayerForTrackID..I corrected it with a trackID : "
t2711873" But still getting same error..

Regards
Punith
...

Punith Raj

unread,
Apr 14, 2015, 10:27:49 AM4/14/15
to rdio...@googlegroups.com
Works!!!!!! , i was trying for tracks which had canStream: false. Tested with other track..everything works great. Thanks

Regards
Punith
Reply all
Reply to author
Forward
0 new messages