问题
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:
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.
来源:https://stackoverflow.com/questions/20536036/using-android-mediaplayer-object-for-multiple-datasources-use-of-release