How can I play the camera sound of a specific device when shooting?

Taking a picture on Android is pretty trivial:

camera.takePicture(null, null, mPicture);

      

My only concern is that there is no audible or visual indication.

Making a visual shutter animation on my layout sounds tricky, but I think I can handle it, but I'd really like to reproduce the original Android camera sound.

Since this sound can be specific to different manufacturers, I'm just wondering if it was a sound that we could easily use in an application.

Thanks for any help

Edit:

I found this snippet, but I believe there is a better way to achieve it:

        // Play the Shutter Sound
        AudioManager meng = (AudioManager) FullscreenActivity.this.getSystemService(
                Context.AUDIO_SERVICE);
        int volume = meng.getStreamVolume(AudioManager.STREAM_NOTIFICATION);


        if (volume != 0) {
            if (_shootMP == null)
                _shootMP = MediaPlayer
                        .create(FullscreenActivity.this,
                                Uri.parse("file:///system/media/audio/ui/camera_click.ogg"));
            if (_shootMP != null)
                _shootMP.start();
        }

      

Source: Alex Cohn

+3


source to share





All Articles