开发者

Does it make sense to set up mediaPlayer to run in a separate thread in Android?

开发者 https://www.devze.com 2023-01-22 20:11 出处:网络
I\'ve recently begun experimenting with a mediaPlayer instance in my Android app.I implemented a couple different beeps for feedback to the user.Now, when I implemented an audioTrack (for a completely

I've recently begun experimenting with a mediaPlayer instance in my Android app. I implemented a couple different beeps for feedback to the user. Now, when I implemented an audioTrack (for a completely different purpose), I discovered that it pretty much sets itself up as a separate thread automatically (as far as I can tell). It certainly appears as a separate thread when I run my code in the debugger: Thread [<17> AudioTrackThread] (Running)

My questio开发者_运维问答n is: Does mediaPlayer do something similar? My first guess is that it does not -- or I would see thread descriptions in the debugger, right??

Anyway, now I've got to questions: 1) Can I set up my mediaPlayers as separate threads and still have them work right? 2) Does it make sense even to try it?

Thanks, R.


MediaPlayer will still work like its supposed to in a thread, I've done that before so I could still do everything asynchronously without using the callbacks. I wouldn't spawn more than one of them though they use a lot of resources.

0

精彩评论

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