capacitor-plugin-vonage 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/android/build.gradle +1 -2
- package/android/src/main/AndroidManifest.xml +0 -0
- package/android/src/main/java/com/managemyhealth/plugin/vonage/VideoCallActivity.java +38 -4
- package/android/src/main/java/com/managemyhealth/plugin/vonage/vonage.java +0 -0
- package/android/src/main/java/com/managemyhealth/plugin/vonage/vonagePlugin.java +41 -7
- package/android/src/main/res/.gitkeep +0 -0
- package/android/src/main/res/drawable/callend.png +0 -0
- package/android/src/main/res/drawable/callstart.png +0 -0
- package/android/src/main/res/drawable/cameraoff.png +0 -0
- package/android/src/main/res/drawable/cameraonwhite.png +0 -0
- package/android/src/main/res/drawable/cameraswitch.png +0 -0
- package/android/src/main/res/drawable/ic_launcher_background.xml +0 -0
- package/android/src/main/res/drawable/microphoneoff.png +0 -0
- package/android/src/main/res/drawable/microphoneonwhite.png +0 -0
- package/android/src/main/res/layout/activity_main.xml +0 -0
- package/android/src/main/res/layout/video_call_layout.xml +5 -3
- package/android/src/main/res.zip +0 -0
- package/dist/docs.json +10 -0
- package/dist/esm/definitions.d.ts +3 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +3 -0
- package/dist/esm/web.js +4 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +4 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +4 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/VideoChatViewController.swift +33 -7
- package/ios/Plugin/vonagePlugin.m +1 -0
- package/ios/Plugin/vonagePlugin.swift +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
@@ -15,6 +15,7 @@ npx cap sync
|
|
15
15
|
|
16
16
|
* [`echo(...)`](#echo)
|
17
17
|
* [`openVideoCallWindow(...)`](#openvideocallwindow)
|
18
|
+
* [`endVideoCall()`](#endvideocall)
|
18
19
|
* [`addListener([eventName: 'VideoCallEnded', listenerFunc: (info: any) => void] | [eventName: 'VideoCallStarted', listenerFunc: (info: any) => void], ...)`](#addlistenereventname-videocallended-listenerfunc-info-any--void--eventname-videocallstarted-listenerfunc-info-any--void)
|
19
20
|
* [Interfaces](#interfaces)
|
20
21
|
* [Type Aliases](#type-aliases)
|
@@ -54,6 +55,17 @@ openVideoCallWindow(options: Object) => Promise<{ value: any; }>
|
|
54
55
|
--------------------
|
55
56
|
|
56
57
|
|
58
|
+
### endVideoCall()
|
59
|
+
|
60
|
+
```typescript
|
61
|
+
endVideoCall() => Promise<{ value: string; }>
|
62
|
+
```
|
63
|
+
|
64
|
+
**Returns:** <code>Promise<{ value: string; }></code>
|
65
|
+
|
66
|
+
--------------------
|
67
|
+
|
68
|
+
|
57
69
|
### addListener([eventName: 'VideoCallEnded', listenerFunc: (info: any) => void] | [eventName: 'VideoCallStarted', listenerFunc: (info: any) => void], ...)
|
58
70
|
|
59
71
|
```typescript
|
package/android/build.gradle
CHANGED
@@ -51,7 +51,6 @@ repositories {
|
|
51
51
|
dependencies {
|
52
52
|
implementation 'com.google.android.material:material:1.4.0'
|
53
53
|
implementation 'pub.devrel:easypermissions:3.0.0'
|
54
|
-
implementation 'com.opentok.android:opentok-android-sdk:2.22.0'
|
55
54
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
56
55
|
implementation project(':capacitor-android')
|
57
56
|
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
@@ -62,7 +61,7 @@ dependencies {
|
|
62
61
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
63
62
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
64
63
|
implementation 'androidx.annotation:annotation:1.7.0'
|
65
|
-
implementation 'com.opentok.android:opentok-android-sdk:2.
|
64
|
+
implementation 'com.opentok.android:opentok-android-sdk:2.26.2'
|
66
65
|
androidTestImplementation 'androidx.test:runner:1.5.2'
|
67
66
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
68
67
|
|
File without changes
|
@@ -52,6 +52,7 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
|
|
52
52
|
boolean isMuted = false;
|
53
53
|
boolean isCamOff = false;
|
54
54
|
boolean isTimeron = false;
|
55
|
+
boolean isEndall = false;
|
55
56
|
private Subscriber subscriber;
|
56
57
|
private FrameLayout publisherViewContainer;
|
57
58
|
private FrameLayout subscriberViewContainer;
|
@@ -121,8 +122,14 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
|
|
121
122
|
publisherViewContainer.removeAllViews();
|
122
123
|
}
|
123
124
|
Intent resultIntent = new Intent();
|
124
|
-
String resultcode =
|
125
|
-
|
125
|
+
String resultcode = "";
|
126
|
+
|
127
|
+
if(isEndall){
|
128
|
+
resultcode= "111";
|
129
|
+
}else{
|
130
|
+
resultcode = ISPROVIDER ? "999" : "888";
|
131
|
+
}
|
132
|
+
resultIntent.putExtra("result_key", resultcode);
|
126
133
|
setResult(RESULT_OK, resultIntent);
|
127
134
|
// setResult(RESULT_CANCELED); // Use this to indicate cancellation
|
128
135
|
|
@@ -160,10 +167,15 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
|
|
160
167
|
subscriberViewContainer.removeAllViews();
|
161
168
|
Intent resultIntent = new Intent();
|
162
169
|
String resultcode = ISPROVIDER?"999":"888";
|
163
|
-
resultIntent.putExtra("result_key", resultcode);
|
170
|
+
resultIntent.putExtra("result_key", resultcode);
|
164
171
|
setResult(RESULT_OK, resultIntent);
|
165
172
|
finish();
|
166
173
|
}
|
174
|
+
}else{
|
175
|
+
if (subscriber != null) {
|
176
|
+
subscriber = null;
|
177
|
+
subscriberViewContainer.removeAllViews();
|
178
|
+
}
|
167
179
|
}
|
168
180
|
}
|
169
181
|
|
@@ -201,6 +213,12 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
|
|
201
213
|
}
|
202
214
|
}
|
203
215
|
|
216
|
+
@Override
|
217
|
+
public void onBackPressed() {
|
218
|
+
Log.d("onBack","Called===============");
|
219
|
+
session.disconnect();
|
220
|
+
}
|
221
|
+
|
204
222
|
@Override
|
205
223
|
protected void onCreate(Bundle savedInstanceState) {
|
206
224
|
|
@@ -315,6 +333,22 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
|
|
315
333
|
if (session != null) {
|
316
334
|
session.onResume();
|
317
335
|
}
|
336
|
+
}
|
337
|
+
public void endCall() {
|
338
|
+
isEndall =true;
|
339
|
+
killvc();
|
340
|
+
|
341
|
+
}
|
342
|
+
public void killvc(){
|
343
|
+
runOnUiThread(new Runnable() {
|
344
|
+
@Override
|
345
|
+
public void run() {
|
346
|
+
Log.d("endVideoCall","PluginMethodendVideoCall");
|
347
|
+
// Update UI components or perform UI-related operations here
|
348
|
+
}
|
349
|
+
});
|
350
|
+
|
351
|
+
|
318
352
|
}
|
319
353
|
private void startTimer() {
|
320
354
|
// startTime = System.currentTimeMillis();
|
@@ -427,7 +461,7 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
|
|
427
461
|
session.disconnect();
|
428
462
|
Intent resultIntent = new Intent();
|
429
463
|
String resultcode = ISPROVIDER?"999":"888";
|
430
|
-
resultIntent.putExtra("result_key", resultcode);
|
464
|
+
resultIntent.putExtra("result_key", resultcode);
|
431
465
|
setResult(RESULT_OK, resultIntent);
|
432
466
|
this.finish();
|
433
467
|
}
|
File without changes
|
@@ -9,6 +9,7 @@ import com.opentok.android.Subscriber;
|
|
9
9
|
import android.app.Activity;
|
10
10
|
import android.content.Intent;
|
11
11
|
import android.os.Handler;
|
12
|
+
import android.os.Looper;
|
12
13
|
import android.util.Log;
|
13
14
|
|
14
15
|
import com.getcapacitor.JSObject;
|
@@ -20,10 +21,33 @@ import com.getcapacitor.annotation.CapacitorPlugin;
|
|
20
21
|
|
21
22
|
@CapacitorPlugin(name = "vonage",requestCodes = {999})
|
22
23
|
public class vonagePlugin extends Plugin {
|
23
|
-
|
24
|
+
String Tag = "VONAGETAG";
|
25
|
+
Boolean isProvid=false;
|
24
26
|
private Session session;
|
25
27
|
|
26
28
|
private String TAG = "Capacitor_Vonage_plugin";
|
29
|
+
|
30
|
+
@PluginMethod()
|
31
|
+
public void endVideoCall(PluginCall call) {
|
32
|
+
showLog("endVideoCallPluginMethod");
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
Handler mainHandler = new Handler(Looper.getMainLooper());
|
37
|
+
Runnable myRunnable = new Runnable() {
|
38
|
+
@Override
|
39
|
+
public void run() {
|
40
|
+
try{
|
41
|
+
VideoCallActivity videoCallActivity = new VideoCallActivity();
|
42
|
+
videoCallActivity.endCall();
|
43
|
+
}catch (Exception e){
|
44
|
+
showLog(e.toString());
|
45
|
+
}
|
46
|
+
}
|
47
|
+
};
|
48
|
+
mainHandler.post(myRunnable);
|
49
|
+
|
50
|
+
}
|
27
51
|
@PluginMethod()
|
28
52
|
public void openVideoCallWindow(PluginCall call) {
|
29
53
|
|
@@ -35,6 +59,7 @@ public class vonagePlugin extends Plugin {
|
|
35
59
|
final String PUBLISHERNAME = call.getString("publisherName");
|
36
60
|
final String SUBSCRIBERNAME = call.getString("subscriberName");
|
37
61
|
final Boolean ISPROVIDER = call.getBoolean("isProvider");
|
62
|
+
isProvid = ISPROVIDER;
|
38
63
|
// initializeSession(API_KEY, SESSION_ID, TOKEN);
|
39
64
|
Intent intent = new Intent(getContext(), VideoCallActivity.class);
|
40
65
|
intent.putExtra("apiKey",API_KEY);
|
@@ -48,14 +73,14 @@ public class vonagePlugin extends Plugin {
|
|
48
73
|
// notifyListeners("onDataReceived", );
|
49
74
|
// StartedCall();
|
50
75
|
Handler handler = new Handler();
|
51
|
-
int delayMillis =
|
76
|
+
int delayMillis = 2000;
|
52
77
|
|
53
78
|
handler.postDelayed(new Runnable() {
|
54
79
|
@Override
|
55
80
|
public void run() {
|
56
|
-
|
57
81
|
eventData.put("isProvider", ISPROVIDER);
|
58
82
|
notifyListeners("VideoCallStarted",eventData);
|
83
|
+
Log.d("VIDEOCALL","isProvider634");
|
59
84
|
}
|
60
85
|
}, delayMillis);
|
61
86
|
startActivityForResult(call,intent,999);
|
@@ -73,12 +98,18 @@ public class vonagePlugin extends Plugin {
|
|
73
98
|
Log.d(TAG, String.valueOf(resultCode));
|
74
99
|
Log.d(TAG, String.valueOf(requestCode));
|
75
100
|
Log.d(TAG, String.valueOf(data));
|
76
|
-
String result =
|
77
|
-
|
101
|
+
String result = "";
|
102
|
+
try{
|
103
|
+
result = data.getStringExtra("result_key");
|
104
|
+
showLog("result");
|
105
|
+
showLog(result);
|
106
|
+
}catch(Exception e){
|
107
|
+
showLog("ewererewrwerwe");
|
108
|
+
showLog(e.toString());
|
109
|
+
}
|
110
|
+
if(isProvid){
|
78
111
|
eventData.put("isProvider", true);
|
79
112
|
notifyListeners("VideoCallEnded",eventData);
|
80
|
-
|
81
|
-
|
82
113
|
}else{
|
83
114
|
eventData.put("isProvider", false);
|
84
115
|
Log.d(TAG,"CODE 98 -----------" );
|
@@ -122,4 +153,7 @@ public class vonagePlugin extends Plugin {
|
|
122
153
|
// session.setSessionListener(sessionListener);
|
123
154
|
// session.connect(token);
|
124
155
|
// }
|
156
|
+
private void showLog(String log){
|
157
|
+
Log.d(Tag,log);
|
158
|
+
}
|
125
159
|
}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -37,7 +37,7 @@
|
|
37
37
|
android:layout_height="match_parent" />
|
38
38
|
|
39
39
|
<TextView
|
40
|
-
android:id="@+id/
|
40
|
+
android:id="@+id/publisherName"
|
41
41
|
android:layout_width="140dp"
|
42
42
|
android:layout_height="157dp"
|
43
43
|
android:layout_gravity="bottom|start"
|
@@ -68,16 +68,18 @@
|
|
68
68
|
android:layout_marginRight="16dp"
|
69
69
|
android:layout_marginBottom="80dp"
|
70
70
|
android:background="#FFFFFF"
|
71
|
+
android:layout_below="@id/subscriberName"
|
72
|
+
|
71
73
|
android:padding="2dp" >
|
74
|
+
|
72
75
|
<TextView
|
73
|
-
android:id="@+id/
|
76
|
+
android:id="@+id/subscriberName"
|
74
77
|
android:layout_width="wrap_content"
|
75
78
|
android:layout_height="wrap_content"
|
76
79
|
android:layout_gravity="bottom|start"
|
77
80
|
android:textSize="12sp"
|
78
81
|
android:text="Subscriber Name"
|
79
82
|
android:paddingBottom="5dp"
|
80
|
-
android:visibility="visible"
|
81
83
|
android:textColor="@android:color/background_dark" />
|
82
84
|
</FrameLayout>
|
83
85
|
|
package/android/src/main/res.zip
CHANGED
File without changes
|
package/dist/docs.json
CHANGED
@@ -39,6 +39,16 @@
|
|
39
39
|
],
|
40
40
|
"slug": "openvideocallwindow"
|
41
41
|
},
|
42
|
+
{
|
43
|
+
"name": "endVideoCall",
|
44
|
+
"signature": "() => Promise<{ value: string; }>",
|
45
|
+
"parameters": [],
|
46
|
+
"returns": "Promise<{ value: string; }>",
|
47
|
+
"tags": [],
|
48
|
+
"docs": "",
|
49
|
+
"complexTypes": [],
|
50
|
+
"slug": "endvideocall"
|
51
|
+
},
|
42
52
|
{
|
43
53
|
"name": "addListener",
|
44
54
|
"signature": "(...args: [eventName: \"VideoCallEnded\", listenerFunc: (info: any) => void] | [eventName: \"VideoCallStarted\", listenerFunc: (info: any) => void]) => Promise<PluginListenerHandle> & PluginListenerHandle",
|
@@ -8,5 +8,8 @@ export interface vonagePlugin {
|
|
8
8
|
openVideoCallWindow(options: Object): Promise<{
|
9
9
|
value: any;
|
10
10
|
}>;
|
11
|
+
endVideoCall(): Promise<{
|
12
|
+
value: string;
|
13
|
+
}>;
|
11
14
|
addListener(...args: [eventName: 'VideoCallEnded', listenerFunc: (info: any) => void] | [eventName: 'VideoCallStarted', listenerFunc: (info: any) => void]): Promise<PluginListenerHandle> & PluginListenerHandle;
|
12
15
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import { PluginListenerHandle } from \"@capacitor/core\";\n\nexport interface vonagePlugin {\n echo(options: { value: string }): Promise<{ value: string }>;\n openVideoCallWindow(options: Object): Promise<{ value: any }>;\n addListener(...args: [eventName: 'VideoCallEnded', listenerFunc: (info: any) => void] | [eventName: 'VideoCallStarted', listenerFunc: (info: any) => void]): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n}\n"]}
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import { PluginListenerHandle } from \"@capacitor/core\";\n\nexport interface vonagePlugin {\n echo(options: { value: string }): Promise<{ value: string }>;\n openVideoCallWindow(options: Object): Promise<{ value: any }>;\n endVideoCall(): Promise<{ value: string }>;\n addListener(...args: [eventName: 'VideoCallEnded', listenerFunc: (info: any) => void] | [eventName: 'VideoCallStarted', listenerFunc: (info: any) => void]): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n}\n"]}
|
package/dist/esm/web.d.ts
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
import { WebPlugin } from '@capacitor/core';
|
2
2
|
import type { vonagePlugin } from './definitions';
|
3
3
|
export declare class vonageWeb extends WebPlugin implements vonagePlugin {
|
4
|
+
endVideoCall(): Promise<{
|
5
|
+
value: string;
|
6
|
+
}>;
|
4
7
|
echo(options: {
|
5
8
|
value: string;
|
6
9
|
}): Promise<{
|
package/dist/esm/web.js
CHANGED
package/dist/esm/web.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,SAAU,SAAQ,SAAS;IACtC,KAAK,CAAC,IAAI,CAAC,OAA0B;QACnC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,KAAK,CAAC,mBAAmB,CAAC,OAAe;QACvC,IAAI,UAAc,CAAC;QACnB,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;QAC5C,OAAO,UAAU,CAAC;IACpB,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { vonagePlugin } from './definitions';\n\nexport class vonageWeb extends WebPlugin implements vonagePlugin {\n async echo(options: { value: string }): Promise<{ value: string }> {\n console.log('ECHO', options);\n return options;\n }\n async openVideoCallWindow(options: Object): Promise<{ value: any }>{\n let dummyValue:any;\n console.log('openVideoCallWindow', options);\n return dummyValue;\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,SAAU,SAAQ,SAAS;IACtC,YAAY;QACV,IAAI,UAAc,CAAC;QACnB,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,OAA0B;QACnC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,KAAK,CAAC,mBAAmB,CAAC,OAAe;QACvC,IAAI,UAAc,CAAC;QACnB,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;QAC5C,OAAO,UAAU,CAAC;IACpB,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { vonagePlugin } from './definitions';\n\nexport class vonageWeb extends WebPlugin implements vonagePlugin {\n endVideoCall(): Promise<{ value: string; }> {\n let dummyValue:any;\n return dummyValue;\n }\n async echo(options: { value: string }): Promise<{ value: string }> {\n console.log('ECHO', options);\n return options;\n }\n async openVideoCallWindow(options: Object): Promise<{ value: any }>{\n let dummyValue:any;\n console.log('openVideoCallWindow', options);\n return dummyValue;\n }\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
package/dist/plugin.cjs.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst vonage = registerPlugin('vonage', {\n web: () => import('./web').then(m => new m.vonageWeb()),\n});\nexport * from './definitions';\nexport { vonage };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class vonageWeb extends WebPlugin {\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async openVideoCallWindow(options) {\n let dummyValue;\n console.log('openVideoCallWindow', options);\n return dummyValue;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,MAAM,GAAGA,mBAAc,CAAC,QAAQ,EAAE;AACxC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;AAC3D,CAAC;;ACFM,MAAM,SAAS,SAASC,cAAS,CAAC;AACzC,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACrC,QAAQ,OAAO,OAAO,CAAC;AACvB,KAAK;AACL,IAAI,MAAM,mBAAmB,CAAC,OAAO,EAAE;AACvC,QAAQ,IAAI,UAAU,CAAC;AACvB,QAAQ,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;AACpD,QAAQ,OAAO,UAAU,CAAC;AAC1B,KAAK;AACL;;;;;;;;;"}
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst vonage = registerPlugin('vonage', {\n web: () => import('./web').then(m => new m.vonageWeb()),\n});\nexport * from './definitions';\nexport { vonage };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class vonageWeb extends WebPlugin {\n endVideoCall() {\n let dummyValue;\n return dummyValue;\n }\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async openVideoCallWindow(options) {\n let dummyValue;\n console.log('openVideoCallWindow', options);\n return dummyValue;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,MAAM,GAAGA,mBAAc,CAAC,QAAQ,EAAE;AACxC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;AAC3D,CAAC;;ACFM,MAAM,SAAS,SAASC,cAAS,CAAC;AACzC,IAAI,YAAY,GAAG;AACnB,QAAQ,IAAI,UAAU,CAAC;AACvB,QAAQ,OAAO,UAAU,CAAC;AAC1B,KAAK;AACL,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACrC,QAAQ,OAAO,OAAO,CAAC;AACvB,KAAK;AACL,IAAI,MAAM,mBAAmB,CAAC,OAAO,EAAE;AACvC,QAAQ,IAAI,UAAU,CAAC;AACvB,QAAQ,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;AACpD,QAAQ,OAAO,UAAU,CAAC;AAC1B,KAAK;AACL;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
package/dist/plugin.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst vonage = registerPlugin('vonage', {\n web: () => import('./web').then(m => new m.vonageWeb()),\n});\nexport * from './definitions';\nexport { vonage };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class vonageWeb extends WebPlugin {\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async openVideoCallWindow(options) {\n let dummyValue;\n console.log('openVideoCallWindow', options);\n return dummyValue;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,MAAM,GAAGA,mBAAc,CAAC,QAAQ,EAAE;IACxC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;IAC3D,CAAC;;ICFM,MAAM,SAAS,SAASC,cAAS,CAAC;IACzC,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;IACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,QAAQ,OAAO,OAAO,CAAC;IACvB,KAAK;IACL,IAAI,MAAM,mBAAmB,CAAC,OAAO,EAAE;IACvC,QAAQ,IAAI,UAAU,CAAC;IACvB,QAAQ,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;IACpD,QAAQ,OAAO,UAAU,CAAC;IAC1B,KAAK;IACL;;;;;;;;;;;;;;;;;"}
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst vonage = registerPlugin('vonage', {\n web: () => import('./web').then(m => new m.vonageWeb()),\n});\nexport * from './definitions';\nexport { vonage };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class vonageWeb extends WebPlugin {\n endVideoCall() {\n let dummyValue;\n return dummyValue;\n }\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async openVideoCallWindow(options) {\n let dummyValue;\n console.log('openVideoCallWindow', options);\n return dummyValue;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,MAAM,GAAGA,mBAAc,CAAC,QAAQ,EAAE;IACxC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;IAC3D,CAAC;;ICFM,MAAM,SAAS,SAASC,cAAS,CAAC;IACzC,IAAI,YAAY,GAAG;IACnB,QAAQ,IAAI,UAAU,CAAC;IACvB,QAAQ,OAAO,UAAU,CAAC;IAC1B,KAAK;IACL,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;IACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,QAAQ,OAAO,OAAO,CAAC;IACvB,KAAK;IACL,IAAI,MAAM,mBAAmB,CAAC,OAAO,EAAE;IACvC,QAAQ,IAAI,UAAU,CAAC;IACvB,QAAQ,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;IACpD,QAAQ,OAAO,UAAU,CAAC;IAC1B,KAAK;IACL;;;;;;;;;;;;;;;;;"}
|
@@ -9,6 +9,7 @@ import UIKit
|
|
9
9
|
import OpenTok
|
10
10
|
|
11
11
|
class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDelegate,OTSubscriberDelegate {
|
12
|
+
var isCallEnded = false
|
12
13
|
var kApiKey = ""
|
13
14
|
var kSessionId = ""
|
14
15
|
var kToken = ""
|
@@ -41,6 +42,7 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
|
|
41
42
|
var counter = 0
|
42
43
|
var timer = Timer()
|
43
44
|
override func viewDidLoad() {
|
45
|
+
|
44
46
|
super.viewDidLoad()
|
45
47
|
self.navigationController?.navigationBar.isHidden = true
|
46
48
|
self.viewSetupMethod()
|
@@ -85,11 +87,21 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
|
|
85
87
|
}
|
86
88
|
override func viewDidAppear(_ animated: Bool) {
|
87
89
|
super.viewDidAppear(animated)
|
90
|
+
NotificationCenter.default.addObserver(self,selector:#selector(endVideoCall(_:)),name: NSNotification.Name ("EndVideoCall"),object: nil)
|
88
91
|
// DispatchQueue.main.asyncAfter(deadline: .now() + 1.0, execute: {
|
89
92
|
//
|
90
93
|
// self.connectToAnOpenTokSession()
|
91
94
|
// })
|
92
95
|
}
|
96
|
+
override func viewDidDisappear(_ animated: Bool) {
|
97
|
+
super.viewDidDisappear(animated)
|
98
|
+
NotificationCenter.default.removeObserver(self, name: NSNotification.Name("EndVideoCall"), object: nil)
|
99
|
+
}
|
100
|
+
@objc func endVideoCall(_ notification: Notification){
|
101
|
+
print("end video call called")
|
102
|
+
endVonageCall()
|
103
|
+
NotificationCenter.default.removeObserver(self, name: NSNotification.Name("EndVideoCall"), object: nil)
|
104
|
+
}
|
93
105
|
func startTimer(){
|
94
106
|
timer.invalidate()
|
95
107
|
timer = Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(timerAction), userInfo: nil, repeats: true)
|
@@ -208,6 +220,13 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
|
|
208
220
|
audioBtn.addTarget(self, action:#selector(self.audioBtnbuttonClicked), for: .touchUpInside)
|
209
221
|
bottomView.addSubview(audioBtn)
|
210
222
|
|
223
|
+
}
|
224
|
+
deinit{
|
225
|
+
if(!isCallEnded){
|
226
|
+
let userInfo = ["userInfo": ["isProvider": self.isProvider]]
|
227
|
+
NotificationCenter.default.post(name: NSNotification.Name(NotificationNames.videoEnded),object: nil,userInfo: userInfo)
|
228
|
+
}
|
229
|
+
|
211
230
|
}
|
212
231
|
|
213
232
|
@objc func callBtnbuttonClicked() {
|
@@ -391,14 +410,21 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
|
|
391
410
|
}
|
392
411
|
|
393
412
|
@IBAction func endCallAction(_ sender: Any) {
|
394
|
-
|
395
|
-
let userInfo = ["userInfo": ["isProvider": isProvider]]
|
413
|
+
isCallEnded = true
|
414
|
+
let userInfo = ["userInfo": ["isProvider": self.isProvider]]
|
396
415
|
NotificationCenter.default.post(name: NSNotification.Name(NotificationNames.videoEnded),object: nil,userInfo: userInfo)
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
416
|
+
endVonageCall()
|
417
|
+
}
|
418
|
+
fileprivate func endVonageCall(){
|
419
|
+
isCallEnded = true
|
420
|
+
DispatchQueue.main.async {
|
421
|
+
|
422
|
+
self.cleanupSubscriber()
|
423
|
+
self.cleanupPublisher()
|
424
|
+
self.session?.disconnect(nil)
|
425
|
+
self.stopTimer()
|
426
|
+
// self.dismiss(animated: true, completion: nil)
|
427
|
+
}
|
402
428
|
}
|
403
429
|
fileprivate func cleanupSubscriber() {
|
404
430
|
subscriber?.view?.removeFromSuperview()
|
@@ -46,6 +46,10 @@ public class vonagePlugin: CAPPlugin {
|
|
46
46
|
|
47
47
|
call.resolve(["value": "Video call initiated"])
|
48
48
|
}
|
49
|
+
@objc func endVideoCall(_ call: CAPPluginCall) {
|
50
|
+
NotificationCenter.default.post(name: NSNotification.Name("EndVideoCall"),object: nil,userInfo: nil)
|
51
|
+
call.resolve(["value": "Video call ended."])
|
52
|
+
}
|
49
53
|
@objc func videoEnded(_ notification: Notification){
|
50
54
|
self.notifyListeners(NotificationNames.videoEnded, data: notification.userInfo?["userInfo"] as? [String: Any] ?? [:])
|
51
55
|
NotificationCenter.default.removeObserver(self, name: NSNotification.Name(NotificationNames.videoEnded), object: nil)
|