代码
private MediaPlayer mRingPlayer; /** * 播放铃声 */ private void startRing(){ if (mRingPlayer != null){ mRingPlayer.stop(); mRingPlayer.release(); mRingPlayer = null; } mRingPlayer = MediaPlayer.create(this, R.raw.video_request); mRingPlayer.setLooping(true); mRingPlayer.start(); } /** * 停止铃声 */ private void stopRing(){ if (mRingPlayer != null){ mRingPlayer.stop(); mRingPlayer.release(); mRingPlayer = null; } }
原文地址:https://www.cnblogs.com/guanxinjing/p/12013132.html
时间: 2024-11-08 20:17:08