Skip to content

Commit

Permalink
turn off the shutter sound
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis Fernando Pimenta committed Jan 14, 2018
1 parent 5efd791 commit dcc1edf
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 14 deletions.
54 changes: 40 additions & 14 deletions package.json
@@ -1,7 +1,41 @@
{
"name": "cordova-plugin-camera-preview",
"version": "0.9.0",
"_from": "git+https://github.com/luispimenta/cordova-plugin-camera-preview.git",
"_id": "cordova-plugin-camera-preview@0.9.0",
"_inBundle": false,
"_integrity": "sha1-n644iCtLF7iBNTXZutcSbzfSb+E=",
"_location": "/cordova-plugin-camera-preview",
"_phantomChildren": {},
"_requested": {
"type": "git",
"raw": "https://github.com/luispimenta/cordova-plugin-camera-preview.git",
"rawSpec": "https://github.com/luispimenta/cordova-plugin-camera-preview.git",
"saveSpec": "git+https://github.com/luispimenta/cordova-plugin-camera-preview.git",
"fetchSpec": "https://github.com/luispimenta/cordova-plugin-camera-preview.git",
"gitCommittish": "master"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "git+https://github.com/luispimenta/cordova-plugin-camera-preview.git#5efd7914e33859b1b903acb9805504120268da53",
"_spec": "https://github.com/luispimenta/cordova-plugin-camera-preview.git",
"_where": "/Users/pimenta/projetos/faceCaptcha/cordova/sample",
"author": {
"name": "Weston Ganger",
"email": "westonganger@gmail.com",
"url": "solidfoundationwebdev.com"
},
"bugs": {
"url": "https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview/issues"
},
"bundleDependencies": false,
"dependencies": {
"cordova": "*"
},
"deprecated": false,
"description": "Cordova plugin that allows camera interaction from HTML code for showing camera preview below or on top of the HTML.",
"devDependencies": {},
"homepage": "https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview",
"keywords": [
"cordova",
"phonegap",
Expand All @@ -16,20 +50,12 @@
"camera-preview",
"preview"
],
"license": "Apache 2.0",
"name": "cordova-plugin-camera-preview",
"repository": {
"type": "git",
"url": "https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview"
"url": "git+https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview.git"
},
"author": {
"name": "Weston Ganger",
"email": "westonganger@gmail.com",
"url": "solidfoundationwebdev.com"
},
"license": "Apache 2.0",
"homepage": "https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview",
"typings": "typescript/CameraPreview.d.ts",
"dependencies": {
"cordova": "*"
},
"devDependencies": {}
"version": "0.9.0"
}
1 change: 1 addition & 0 deletions plugin.xml
Expand Up @@ -52,6 +52,7 @@

<header-file src="src/ios/CameraPreview.h" />
<source-file src="src/ios/CameraPreview.m" />
<resource-file src="src/ios/CameraPreview.bundle" />

<header-file src="src/ios/TemperatureAndTint.h" />
<source-file src="src/ios/TemperatureAndTint.m" />
Expand Down
Binary file added src/ios/CameraPreview.bundle/photoShutter2.caf
Binary file not shown.
11 changes: 11 additions & 0 deletions src/ios/CameraPreview.m
Expand Up @@ -641,7 +641,18 @@ - (void) invokeTakePictureOnFocus {
}

- (void) invokeTakePicture:(CGFloat) width withHeight:(CGFloat) height withQuality:(CGFloat) quality{

AVCaptureConnection *connection = [self.sessionManager.stillImageOutput connectionWithMediaType:AVMediaTypeVideo];

// disabled the sound
static SystemSoundID soundID = 0;
if (soundID == 0) {
NSURL* filePath = [[NSBundle mainBundle] URLForResource:@"CameraPreview.bundle/photoShutter2" withExtension:@"caf"];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)filePath, &soundID);
}
AudioServicesPlaySystemSound(soundID);
///////

[self.sessionManager.stillImageOutput captureStillImageAsynchronouslyFromConnection:connection completionHandler:^(CMSampleBufferRef sampleBuffer, NSError *error) {

NSLog(@"Done creating still image");
Expand Down

0 comments on commit dcc1edf

Please sign in to comment.