Add playRingtone property
MODIFY
MatrixKit/Controllers/MXKCallViewController.h
MatrixKit/Controllers/MXKCallViewController.h
@@ -109,6 +109,14 @@ extern NSString *const kMXKCallViewControllerBackToAppNotification;
*/
@property (nonatomic, weak) id<MXKCallViewControllerDelegate> delegate;
+/*
+ Specifies whether a ringtone must be played on incoming call.
+ It's important to set this value before you will set `mxCall` otherwise value of this property can has no effect.
+
+ Defaults to YES.
+ */
+@property (nonatomic) BOOL playRingtone;
+
#pragma mark - Class methods
/**

MODIFY
MatrixKit/Controllers/MXKCallViewController.m
MatrixKit/Controllers/MXKCallViewController.m
@@ -101,6 +101,8 @@ NSString *const kMXKCallViewControllerBackToAppNotification = @"kMXKCallViewCont
- (void)finalizeInit
{
[super finalizeInit];
+
+ _playRingtone = YES;
}
- (void)viewDidLoad
@@ -394,6 +396,7 @@ NSString *const kMXKCallViewControllerBackToAppNotification = @"kMXKCallViewCont
NSURL *audioUrl;
if (mxCall.isIncoming)
{
+ if (self.playRingtone)
audioUrl = [self audioURLWithName:@"ring"];
}
else
@@ -401,8 +404,11 @@ NSString *const kMXKCallViewControllerBackToAppNotification = @"kMXKCallViewCont
audioUrl = [self audioURLWithName:@"ringback"];
}
+ if (audioUrl)
+ {
[[MXKSoundPlayer sharedInstance] playSoundAt:audioUrl repeat:YES vibrate:mxCall.isIncoming routeToBuiltInReceiver:!mxCall.isIncoming];
}
+ }
else
{
[[MXKSoundPlayer sharedInstance] stopPlaying];

Add playRingtone property