Languages

Menu
Sites
Language
how to play http audio stream

Hi,

I got the problem in http audio play, the code is list below:  same code if play local muisc is OK, but if play http stream,  the player_prepare() will return negative value, BTW the internet privilege already add in manifest .

 

error_code = player_create(&ad->player);
 dlog_print(DLOG_ERROR, LOG_TAG, "player_create = %d", error_code);

//error_code = player_set_uri(ad->player,get_resource_path("audio/manmanfei.mp3"));   //----> this local music is working fine
 error_code = player_set_uri(ad->player, "http://music.baidutt.com/up/kwcawdks/yamkmd.mp3");// -->this network stream is not work
 dlog_print(DLOG_ERROR, LOG_TAG, "player_set_uri() = %d", error_code);
 player_set_sound_type(ad->player, SOUND_TYPE_MEDIA);
 player_set_volume(ad->player, 1.0, 1.0);

 error_code = player_prepare(ad->player);
 dlog_print(DLOG_ERROR, LOG_TAG, "player_prepare() = %d", error_code);

// the debug info is -----player_prepare() = -26476506

 error_code = player_get_state(ad->player, state);

 

Best Regards,

 

Responses

4 Replies
Alex Dem

fyi:

On emulator I have got the same error. On device no errors but this stream does not play.
Alexey.

 

Jean Yang

yes, I have try this on emulator, is this cause by emulator can't access the internet?

Jean Yang

I have try above code, same issue has deteted, anybody have idea on this?

Alex Dem

Hi, 
Not think.
I break internet connection on device, but there are no errors. player_prepare method returns 'success'.
Alexey.