采用了android MediaPlayer对象为多个数据源,采用的释放(); [英] using android mediaPlayer object for multiple dataSources, use of release();

查看:261
本文介绍了采用了android MediaPlayer对象为多个数据源,采用的释放();的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我想用Android的API中的类的MediaPlayer播放几个原始音频文件,之前我更改数据源到不同的文件我需要调用release();该文件说,释放();法会结束MediaPlayer对象,我使用的是相同的MediaPlayer对象到不同的原始文件之间切换,这样会干扰的,还是我只是调用程序结束后发布

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

推荐答案

呼叫复位()第一。它重置的MediaPlayer其未初始化状态。然后,你将不得不通过设置数据源,并调用 prepare()重新初始化。呼叫发布()一旦你用MediaPlayer的实例来完成。

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.

这篇关于采用了android MediaPlayer对象为多个数据源,采用的释放();的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆