HI,
Is there exist method to disable the voice of take picture by code ? Tks!
Is there exist method to disable the voice of take picture by code ? Tks!
Sub Mute
Dim no As NativeObject = Me 'should be inside a sub
no.RunMethod("mute", Null)
End Sub
#if objc
@import MediaPlayer;
- (void) mute {
MPVolumeView* volumeView = [[MPVolumeView alloc] init];
//find the volumeSlider
UISlider* volumeViewSlider = nil;
for (UIView *view in [volumeView subviews]){
if ([view.class.description isEqualToString:@"MPVolumeSlider"]){
volumeViewSlider = (UISlider*)view;
break;
}
}
// mute it here:
[volumeViewSlider setValue:0.0f animated:YES];
[volumeViewSlider sendActionsForControlEvents:UIControlEventTouchUpInside];
}
#end if
'Code module
#Region Project Attributes
#ApplicationLabel: B4i Example
#Version: 1.0.0
'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
#iPhoneOrientations: Portrait, LandscapeLeft, LandscapeRight
#iPadOrientations: Portrait, LandscapeLeft, LandscapeRight, PortraitUpsideDown
#Target: iPhone, iPad
#MinVersion: 7
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Public App As Application
Public NavControl As NavigationController
Private Page1 As Page
Private yn As Boolean
Private xTTS As TTS
End Sub
Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
Page1.Title = "Page 1"
Page1.RootPanel.Color = Colors.White
NavControl.ShowPage(Page1)
'Initialize TTS
xTTS.Initialize("")
End Sub
Private Sub Page1_Resize(Width As Int, Height As Int)
'Speak away
xTTS.Stop
xTTS.Speak("testing testing 1 2 3 4 5 6 7 8 9 10", True)
yn=Not(yn)
If yn Then
Mute
Else
Unmute
End If
End Sub
Private Sub Application_Background
End Sub
Sub Mute
Dim no As NativeObject = Me 'should be inside a sub
no.RunMethod("mute", Null)
End Sub
Sub Unmute
Dim no As NativeObject = Me 'should be inside a sub
no.RunMethod("unmute", Null)
End Sub
#if objc
@import MediaPlayer;
- (void) mute {
MPVolumeView* volumeView = [[MPVolumeView alloc] init];
//find the volumeSlider
UISlider* volumeViewSlider = nil;
for (UIView *view in [volumeView subviews]){
if ([view.class.description isEqualToString:@"MPVolumeSlider"]){
volumeViewSlider = (UISlider*)view;
break;
}
}
// mute it here:
[volumeViewSlider setValue:0.0f animated:YES];
[volumeViewSlider sendActionsForControlEvents:UIControlEventTouchUpInside];
}
- (void) unmute {
MPVolumeView* volumeView = [[MPVolumeView alloc] init];
//find the volumeSlider
UISlider* volumeViewSlider = nil;
for (UIView *view in [volumeView subviews]){
if ([view.class.description isEqualToString:@"MPVolumeSlider"]){
volumeViewSlider = (UISlider*)view;
break;
}
}
// unmute it here:
[volumeViewSlider setValue:1.0f animated:YES];
[volumeViewSlider sendActionsForControlEvents:UIControlEventTouchUpInside];
}
#end if
Why dont you use the LLCamera_Preview event to not have shutter sound?For anyone interested...
Re the code in Erel's post #8:
http://stackoverflow.com/questions/...-the-ringer-or-change-the-ringer-tone-on-ios5
- As demonstrated in my post #9 - it works for muting/unmuting TTS - and I'm guessing music etc.
- I incorporated it into an app that currently emits the camera shutter sound - it does not work.
- I finally discovered that the volume of the camera shutter sound has nothing to do with "MPVolumeView" - it is actually controlled by the ringer volume.
- To test: manually use the buttons on the top left of the phone to adjust ringer volume then use the camera app - the camera shutter sound volume is appropriately altered.
- So, how to programmatically mute or minimize the ringer volume? - I googled a fair bit and only discovered this (or plagiarized copies):
Regards...
- Anyone with Objective C willing to have a go?
- Also posts #7, 8 and 9 still have value - but in a different context - should I initiate a separate thread?
Dim ll as LLCamera
ll.Initialize(myPanel,"myCamera",True)
ll.StartPreview
Sub myCamera_Preview (Image As Bitmap)
Dim myCapturedImage=Image
ll.ReleaseFrame
ll.StopPreview
End Sub
Having got no response to this and in the meantime managing to solve the issues I raised in my post #9, I have put up a thread in iOS Code Snippets:Also posts #7, 8 and 9 still have value - but in a different context - should I initiate a separate thread?