ch.threema.app.ui.LessObnoxiousMediaActionSound.play()

Here are the examples of the java api ch.threema.app.ui.LessObnoxiousMediaActionSound.play() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

19 Source : CameraFragment.java
with GNU Affero General Public License v3.0
from threema-ch

@SuppressLint("UnsafeExperimentalUsageError")
private void startVideoRecording() {
    // play shutter sound
    if (mediaActionSound != null) {
        mediaActionSound.play(LessObnoxiousMediaActionSound.START_VIDEO_RECORDING);
    }
    float bytesPerSecond = ((float) CameraConfig.getDefaultVideoBitrate() / 8F) + ((float) CameraConfig.getDefaultAudioBitrate() / 8F);
    // we replacedume a MP4 overhead of 1 MB
    long durationSeconds = (long) Math.floor((float) (ThreemaApplication.MAX_BLOB_SIZE - 1000000) / bytesPerSecond);
    logger.debug("Calculated video duration: " + LocaleUtil.formatTimerText(durationSeconds * DateUtils.SECOND_IN_MILLIS, true));
    timerView.start(durationSeconds * DateUtils.SECOND_IN_MILLIS, time -> stopVideoRecording());
    cameraView.setCaptureMode(CameraView.CaptureMode.VIDEO);
    if (hasFlash() && cameraView.getFlash() == ImageCapture.FLASH_MODE_ON) {
        cameraView.enableTorch(true);
    }
    cameraView.setZoomRatio(0);
    cameraView.startRecording(new File(cameraCallback.getVideoFilePath()), new RuntimeUtil.MainThreadExecutor(), onVideoSavedCallback);
}

18 Source : CameraFragment.java
with GNU Affero General Public License v3.0
from threema-ch

@SuppressLint("UnsafeExperimentalUsageError")
private void stopVideoRecording() {
    if (timerView != null) {
        timerView.stop();
    }
    // play shutter sound
    if (mediaActionSound != null) {
        mediaActionSound.play(LessObnoxiousMediaActionSound.STOP_VIDEO_RECORDING);
    }
    if (cameraView != null) {
        // THREEMA
        try {
            // enableTorch() may crash with IllegalStateException
            cameraView.enableTorch(false);
        } catch (Exception e) {
        // ignore this
        }
        // THREEMA
        try {
            cameraView.stopRecording();
        } catch (Exception e) {
            logger.error("Exception", e);
        }
    }
}