Here are the examples of the java api android.media.MediaActionSound.play() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
10 Examples
19
Source : OneCameraZslImpl.java
with Apache License 2.0
from Yuloran
with Apache License 2.0
from Yuloran
private void onShutterInvokeUI(final PhotoCaptureParameters params) {
// Tell CaptureModule shutter has occurred so it can flash the screen.
params.callback.onQuickExpose();
// Play shutter click sound.
mMediaActionSound.play(MediaActionSound.SHUTTER_CLICK);
}
19
Source : CameraDeviceController.java
with MIT License
from HarvestProfit
with MIT License
from HarvestProfit
private void makeShutterSound() {
AudioManager audio = (AudioManager) mActivity.getSystemService(Context.AUDIO_SERVICE);
if (audio.getRingerMode() == AudioManager.RINGER_MODE_NORMAL) {
MediaActionSound sound = new MediaActionSound();
sound.play(MediaActionSound.SHUTTER_CLICK);
}
}
18
Source : ARGraphActivity.java
with BSD 2-Clause "Simplified" License
from the-losers
with BSD 2-Clause "Simplified" License
from the-losers
private void shutterSound(boolean toPlay) {
AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
switch(audio.getRingerMode()) {
case AudioManager.RINGER_MODE_NORMAL:
if (toPlay) {
sound.play(MediaActionSound.START_VIDEO_RECORDING);
} else {
sound.play(MediaActionSound.STOP_VIDEO_RECORDING);
}
break;
}
}
17
Source : Utils.java
with GNU General Public License v3.0
from Welthungerhilfe
with GNU General Public License v3.0
from Welthungerhilfe
public static void playShooterSound(Context context, int sample) {
AudioManager audio = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
switch(audio.getRingerMode()) {
case AudioManager.RINGER_MODE_NORMAL:
if (sound == null) {
sound = new MediaActionSound();
}
sound.play(sample);
break;
case AudioManager.RINGER_MODE_SILENT:
break;
case AudioManager.RINGER_MODE_VIBRATE:
break;
}
}
17
Source : RecordButton.java
with MIT License
from sandrios
with MIT License
from sandrios
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void startRecording(MediaActionSound sound) {
sound.play(MediaActionSound.START_VIDEO_RECORDING);
startRecording();
}
17
Source : RecordButton.java
with MIT License
from sandrios
with MIT License
from sandrios
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void takePhoto(MediaActionSound sound) {
sound.play(MediaActionSound.SHUTTER_CLICK);
takePhoto();
}
17
Source : RecordButton.java
with MIT License
from sandrios
with MIT License
from sandrios
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void stopRecording(MediaActionSound sound) {
sound.play(MediaActionSound.STOP_VIDEO_RECORDING);
stopRecording();
}
17
Source : OpenNoteCameraView.java
with MIT License
from Michaelvilleneuve
with MIT License
from Michaelvilleneuve
public void blinkScreenAndShutterSound() {
AudioManager audio = (AudioManager) mActivity.getSystemService(Context.AUDIO_SERVICE);
switch(audio.getRingerMode()) {
case AudioManager.RINGER_MODE_NORMAL:
MediaActionSound sound = new MediaActionSound();
sound.play(MediaActionSound.SHUTTER_CLICK);
break;
case AudioManager.RINGER_MODE_SILENT:
break;
case AudioManager.RINGER_MODE_VIBRATE:
break;
}
}
17
Source : GabrielClientActivity.java
with Apache License 2.0
from cmusatyalab
with Apache License 2.0
from cmusatyalab
private void storeScreenshot(Bitmap bitmap, String path) {
File imageFile = new File(path);
try {
MediaActionSound m = new MediaActionSound();
m.play(MediaActionSound.SHUTTER_CLICK);
OutputStream out = new FileOutputStream(imageFile);
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, out);
out.flush();
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(imageFile)));
Toast.makeText(this, getString(R.string.screenshot_taken, path), Toast.LENGTH_LONG).show();
out.close();
} catch (IOException e) {
Log.e(LOG_TAG, "IOException when attempting to store screenshot", e);
}
}
17
Source : GabrielClientActivity.java
with Apache License 2.0
from cmusatyalab
with Apache License 2.0
from cmusatyalab
private void storeScreenshot(Bitmap bitmap, String path) {
OutputStream out = null;
File imageFile = new File(path);
try {
MediaActionSound m = new MediaActionSound();
m.play(MediaActionSound.SHUTTER_CLICK);
out = new FileOutputStream(imageFile);
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, out);
out.flush();
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(imageFile)));
Toast.makeText(this, getString(R.string.screenshot_taken, path), Toast.LENGTH_LONG).show();
out.close();
} catch (IOException e) {
Log.e(LOG_TAG, "IOException when attempting to store screenshot", e);
}
}