using android mediaPlayer object for multiple data

2019-07-22 03:19发布

I have several raw sound files that I want to play using the MediaPlayer class in the android API, before I change the data source to a different file do I have to call release(); The documentation says that the release(); method will end the MediaPlayer object, I am using the same MediaPlayer object to switch between the different raw files so will that interfere, or do I just call release after the program ends

1条回答
神经病院院长
2楼-- · 2019-07-22 03:47

Call reset() first. It resets the MediaPlayer to its uninitialized state. Then you will have to initialize it again by setting the data source and calling prepare(). Call release() once you are done with the MediaPlayer instance.

查看更多
登录 后发表回答