You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -41,6 +59,21 @@ before that, you should add this project manually:
41
59
1. click your `project's xcodeproject root`, go to `build setting` and search `Objective-C Bridging Header`
42
60
2. set you header location, the default path is: `ReactNativeProjectRoot/ios/`, in this case, you should set `../node_modules/react-native-incall-manager/ios/RNInCallManager/RNInCallManager-Bridging-Header.h`
43
61
62
+
**optional sound files on android**
63
+
if you want to use bundled ringtone/ringback/busytone sound instead of system sound
64
+
65
+
1. add files into your_project directory under your project's xcodeproject root. ( or drag into it as described above. )
66
+
2. check `copy file if needed`
67
+
3. make sure filename correspond to sound type:
68
+
69
+
```
70
+
incallmanager_busytone.mp3
71
+
incallmanager_ringback.mp3
72
+
incallmanager_ringback.mp3
73
+
```
74
+
75
+
on ios, we only support mp3 files currently.
76
+
44
77
## Usage:
45
78
46
79
This module implement a basic handle logic automatically, just:
@@ -59,8 +92,44 @@ InCallManager.stop();
59
92
// ... it will also remote event listeners ...
60
93
```
61
94
95
+
if you want to use ringback:
96
+
97
+
```javascript
98
+
// ringback is basically for OUTGOING call. and is part of start().
99
+
100
+
InCallManager.start({media:'audio', ringback:'_BUNDLE_'}); // or _DEFAULT_ or _DTMF_
101
+
//when callee answered, you MUST stop ringback explicitly:
102
+
InCallManager.stopRingback();
103
+
```
104
+
105
+
if you want to use busytone:
106
+
107
+
```javascript
108
+
// busytone is basically for OUTGOING call. and is part of stop()
109
+
// If the call failed or callee are busing,
110
+
// you may want to stop the call and play busytone
111
+
InCallManager.stop({busytone:'_DTMF_'}); // or _BUNDLE_ or _DEFAULT_
112
+
```
113
+
114
+
if you want to use ringtone:
115
+
116
+
```javascript
117
+
// ringtone is basically for INCOMING call. it's independent to start() and stop()
118
+
// if you receiving an incoming call, before user pick up,
119
+
// you may want to play ringtone to notify user.
120
+
InCallManager.startRingtone('_BUNDLE_'); // or _DEFAULT_ or system filename with extension
121
+
122
+
// when user pickup
123
+
InCallManager.stopRingtone();
124
+
InCallManager.start();
125
+
126
+
// or user hangup
127
+
InCallManager.stopRingtone();
128
+
InCallManager.stop();
129
+
130
+
```
62
131
63
-
and interact with events if you want:
132
+
also can interact with events if you want:
64
133
see API section.
65
134
66
135
```javascript
@@ -80,10 +149,12 @@ DeviceEventEmitter.addListener('Proximity', function (data) {
80
149
* audio will enable proximity sensor which is disabled by default if media=video
81
150
* when proximity detect user closed to screen, turn off screen to avoid accident touch and route voice to earpiece.
82
151
* when newly external device plugged, such as wired-headset, route audio to external device.
152
+
* optional play ringback
83
153
84
154
**on stop:**
85
155
86
156
* set KeepScreenOn flag = false, remote event listeners, restore original user settings.
157
+
* optional play busytone
87
158
88
159
## Custom Behavior:
89
160
@@ -97,13 +168,13 @@ note: ios only supports `auto` currently.
| stop(`{busytone: ?string}`) |:smile:|:smile:| stop incall manager</br> busytone accept non-empty string or it won't play</br> default: `{busytone: ''}`|
102
173
| turnScreenOn() |:smile:|:rage:| force turn screen on |
103
174
| turnScreenOff() |:smile:|:rage:| force turn screen off |
104
175
| setKeepScreenOn(`enable: ?boolean`) |:smile:|:smile:| set KeepScreenOn flag = true or false</br>default: false |
105
176
| setSpeakerphoneOn(`enable: ?boolean`) |:smile:|:rage:| toggle speaker ON/OFF once. but not force</br>default: false |
106
-
| setForceSpeakerphoneOn(`enable: ?boolean`) |:smile:|:smile:|if set to true, will ignore all logic and force audio route to speaker</br>default: false |
177
+
| setForceSpeakerphoneOn(`flag: ?boolean`) |:smile:|:smile:|true -> force speaker on</br> false -> force speaker off</br> null -> use default behavior according to media type</br>default: null|
0 commit comments