streaming - Stream an audio .pls in android -
i'm making radio application uses streaming. here need stream audio link (http://somedomain/some.pls
).
i have created mediaplayer
, know how play audio file. don't know how stream net.
edit : logcat got while used following code
mediaplayer mp = new mediaplayer(); mp.setdatasource(http://somedomain/some.pls); mp.prepare(); mp.start()
by log tag **mediaplayer**
02-15 05:50:11.761: verbose/mediaplayer(23715): constructor 02-15 05:50:11.761: verbose/mediaplayer(23715): setlistener 02-15 05:50:11.761: info/mediaplayer(23715): uri is:http://some:444/sdfd.pls 02-15 05:50:11.761: info/mediaplayer(23715): path null 02-15 05:50:11.761: debug/mediaplayer(23715): couldn't open file on client side, trying server side 02-15 05:50:11.765: verbose/mediaplayer(23715): setdatasource(http://some:444/sdfd.pls) 02-15 05:50:11.777: verbose/mediaplayer(23715): prepare 02-15 05:50:13.105: error/mediaplayer(23715): message received msg=3, ext1=0, ext2=0 02-15 05:50:13.105: verbose/mediaplayer(23715): buffering 0 02-15 05:50:13.105: error/mediaplayer(23715): callback application 02-15 05:50:13.105: error/mediaplayer(23715): callback
by log tag **playerdriver**
02-15 05:50:11.765: verbose/playerdriver(2393): constructor 02-15 05:50:11.765: verbose/playerdriver(2393): opencore hardware module not found 02-15 05:50:11.765: verbose/playerdriver(2393): start player thread 02-15 05:50:11.765: verbose/playerdriver(2393): startplayerthread 02-15 05:50:11.769: verbose/playerdriver(2393): initializeforthread 02-15 05:50:11.769: verbose/playerdriver(2393): omx_masterinit 02-15 05:50:11.769: verbose/playerdriver(2393): osclscheduler::init 02-15 05:50:11.769: verbose/playerdriver(2393): createplayer 02-15 05:50:11.777: verbose/playerdriver(2393): addtoscheduler 02-15 05:50:11.777: verbose/playerdriver(2393): pendforexec 02-15 05:50:11.777: verbose/playerdriver(2393): osclactivescheduler::current 02-15 05:50:11.777: verbose/playerdriver(2393): startscheduler 02-15 05:50:11.777: verbose/playerdriver(2393): send player code: 2 02-15 05:50:11.777: verbose/playerdriver(2393): commandcompleted 02-15 05:50:11.777: verbose/playerdriver(2393): completed command player_setup status=1 02-15 05:50:11.777: info/playerdriver(2393): playerdriver::isprotectedfile(http://some:444/sdfd.pls) 02-15 05:50:11.777: verbose/playerdriver(2393): file ext : .pls 02-15 05:50:11.777: error/playerdriver(2393): playerdriver::it not protected file 02-15 05:50:11.781: verbose/playerdriver(2393): send player code: 3 02-15 05:50:11.781: verbose/playerdriver(2393): handlesetdatasource 02-15 05:50:11.781: verbose/playerdriver(2393): handlesetdatasource- scanning extension 02-15 05:50:11.800: verbose/playerdriver(2393): commandcompleted 02-15 05:50:11.800: verbose/playerdriver(2393): completed command player_set_data_source status=1 02-15 05:50:11.800: verbose/playerdriver(2393): send player code: 6 02-15 05:50:11.800: verbose/playerdriver(2393): release string 2.2 len 3 02-15 05:50:13.101: verbose/playerdriver(2393): handleinformationalevent: 34 02-15 05:50:13.101: verbose/playerdriver(2393): handleinformationalevent: 19 02-15 05:50:13.124: verbose/playerdriver(2393): handleinformationalevent: 20 02-15 05:50:14.511: verbose/playerdriver(2393): handleinformationalevent: 20 02-15 05:50:16.509: verbose/playerdriver(2393): handleinformationalevent: 20
this 02-15 05:50:16.509: verbose/playerdriver(2393): handleinformationalevent: 20
loops no sound ..
may wrong..
thank you.
can use file streaming ability available on mediaplayer class above.
have not tested following code, should on these lines:
mediaplayer mp = new mediaplayer(); mp.setdatasource(http://somedomain/some.pls); mp.prepare(); mp.start();
but remember following:
1. surround each of statements above try
, catch
statements , print copiously logcat
. debug easily.
2. release resources once done it.
hth,
sriram
Comments
Post a Comment