react-native-webrtc / react-native-incall-manager

Handling media-routes/sensors/events during a audio/video chat on React Native
ISC License
547 stars 191 forks source link

I am not able to make custom Ringback tone for iOS Setup in React-native #186

Open viv578ek opened 2 years ago

viv578ek commented 2 years ago

I'm playing ringbacktone for outbound calls using my application.

InCallManager.start({media: 'audio', ringback: 'BUNDLE'});

For Android, it's playing Customs tone working but it's not same in case of iOS. I'm getting default ringtone of iPhone but need to used custom tone.

Also, can anyone let me know the process to define custom audio files as ringback file? and how to set custom tone in iOS side ?

viv578ek commented 2 years ago

I have to try to add React-native Library custom ringback: But Process is going play option but Audio is not coming.

/// File Name : ringback.mp3

NSString soundFilePath = [NSString stringWithFormat:@"%@",[[NSBundle mainBundle] pathForResource:@"ringback" ofType:@"mp3"]]; NSFileManager fileManager = [NSFileManager defaultManager];

if ([fileManager fileExistsAtPath:soundFilePath]){ NSURL *soundFileURL = [NSURL fileURLWithPath:soundFilePath]; _ringback = [[AVAudioPlayer alloc] initWithContentsOfURL:soundFileURL error:nil];//[[AVAudioPlayer alloc] initWithContentsOfURL:ringbackUri error:nil]; _ringback.delegate = self; _ringback.numberOfLoops = -1; // you need to stop it explicitly [_ringback prepareToPlay];

        //self.audioSessionSetCategory(self.incallAudioCategory, [.DefaultToSpeaker, .AllowBluetooth], #function)

// [self audioSessionSetCategory:_incallAudioCategory // options:0 // callerMemo:NSStringFromSelector(_cmd)]; // [self audioSessionSetMode:_incallAudioMode // callerMemo:NSStringFromSelector(_cmd)]; [_ringback play]; }else{ NSLog(@"RNInCallManager.startRingback(): caught error="); }

wilmxre commented 1 year ago

@viv578ek hey man did you manage to solve this?