public synchronized void init() { playerIndex = 0; activeMediaPlayer = null; missionLog.clear(); missionActivity.clearMissionLog(); stopWatch.reset(); }
public synchronized void start() { // Clear the mission introduction when the mission is started (not resumed after a pause) if (stopWatch.missionTimeInNanos() == 0) { missionLog.clear(); missionActivity.clearMissionLog(); } if (mediaPlayerList.size() <= playerIndex) { init(); } stopWatch.start(); stopped = false; if (paused) { paused = false; // Even when a running sound was paused, you have to update the // startTime for the next file startTime += System.nanoTime() - timeWhenPaused; if (activeMediaPlayer == null) { mediaPlayerBackgroundSounds.start(); } else { activeMediaPlayer.start(); } if (activeMediaPlayer == null || activeMediaPlayer.isLooping()) { postAtTime( mPlayNextAudioTask, startTime + mediaPlayerList.get(playerIndex).getStartTimeNanos()); } return; } startTime = System.nanoTime(); playNextAudio(); }