开发者

Android MediaPlayer on UI Thread

开发者 https://www.devze.com 2023-02-10 01:25 出处:网络
When using android\'s mediaplayer to stream audio off the web, is it okay to call all the functions (stop(), reset(), setDataSource(), etc.) on the UI thread, or should I create a separate thread for

When using android's mediaplayer to stream audio off the web, is it okay to call all the functions (stop(), reset(), setDataSource(), etc.) on the UI thread, or should I create a separate thread for that. In other words, will those functions ever take a few seconds to respond and thereby cause pe开发者_JS百科rceptible lag?

If I do have to call them from separate threads, what's the best way to handle that?


I call MediaPlayer methods off the default app thread without any issues. Do be sure to make proper use of its state machine, of course :)

0

精彩评论

暂无评论...
验证码 换一张
取 消