private static void startPlayer(final MediaPlayer player, final Uri uri, final boolean mute, final Consumer<Boolean> onStop) {
        final  Consumer<Boolean> realStop = (b) -> {
            if (onStop != null) {
                try {
                    onStop.accept(b);
                } catch (Exception ex) {
                    Log.e(LOG_PRAEFIX + "error onStop", ex);
                }
            }
        };
        try {
            player.setAudioAttributes(new AudioAttributes.Builder()
                .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
                .setUsage(AudioAttributes.USAGE_MEDIA)
                .build());
            player.setLooping(false);
            setVolume(player, mute);
            player.setDataSource(CgeoApplication.getInstance(), uri);
            player.setOnErrorListener((mp, what, extra) -> {
                Log.e(LOG_PRAEFIX + "error happened: " + what + ", " + extra);
                realStop.accept(false);
                return false;
            });
            player.prepare();
            player.setOnCompletionListener(mp -> realStop.accept(true));
            player.start();
        } catch (Exception e) {
            Log.e(LOG_PRAEFIX + "error trying to play audio", e);
            realStop.accept(false);
        }
    }
Represents and manages one audio file or tone
main/src/main/java/cgeo/geocaching/utils/AudioManager.java