capacitor-plugin-vonage 0.0.8 → 0.0.9
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/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/com/managemyhealth/plugin/vonage/VideoCallActivity.java +36 -55
- package/android/src/main/java/com/managemyhealth/plugin/vonage/vonage.java +0 -0
- package/android/src/main/java/com/managemyhealth/plugin/vonage/vonagePlugin.java +8 -6
- package/android/src/main/res/.gitkeep +0 -0
- package/android/src/main/res/drawable/button_background.xml +0 -0
- package/android/src/main/res/drawable/button_background2.xml +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/circle_shape.xml +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 +1 -3
- package/android/src/main/res/values/colors.xml +0 -0
- package/android/src/main/res/values/strings.xml +0 -0
- package/android/src/main/res.zip +0 -0
- package/ios/Plugin/VideoChatViewController.swift +13 -5
- package/package.json +1 -1
@@ -1,6 +1,7 @@
|
|
1
1
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
2
2
|
<application>
|
3
3
|
<activity android:name="com.managemyhealth.plugin.vonage.VideoCallActivity"
|
4
|
+
android:launchMode="singleTask"
|
4
5
|
android:screenOrientation="portrait">
|
5
6
|
</activity>
|
6
7
|
</application>
|
@@ -57,6 +57,7 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
|
|
57
57
|
|
58
58
|
public Session session;
|
59
59
|
private static Bridge staticBridge = null;
|
60
|
+
private String dummyProfile = "https://www.gravatar.com/avatar/?d=mp";
|
60
61
|
|
61
62
|
public static VideoCallActivity instance;
|
62
63
|
private Publisher publisher;
|
@@ -137,88 +138,63 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
|
|
137
138
|
private final Session.SessionListener sessionListener = new Session.SessionListener() {
|
138
139
|
@Override
|
139
140
|
public void onConnected(Session session) {
|
140
|
-
Log.d(TAG, "onConnected: Connected to session: " + session.getSessionId());
|
141
|
-
// JSObject eventData = new JSObject();
|
142
|
-
// eventData.put("key", "value");
|
143
|
-
// notifyListeners("", eventData);
|
144
141
|
publisher = new Publisher.Builder(VideoCallActivity.this).build();
|
145
142
|
publisher.setPublisherListener(publisherListener);
|
146
143
|
publisher.getRenderer().setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL);
|
147
|
-
Log.d("publisherViewContainer", "publisherViewContainer.toString()");
|
148
144
|
FrameLayout Framelayout = findViewById(R.id.publisher_container);
|
149
|
-
|
150
145
|
try {
|
151
146
|
if (Framelayout != null) {
|
152
|
-
Log.d("publisherViewContainer", "Inside if =======");
|
153
147
|
Framelayout.addView(publisher.getView());
|
154
148
|
}
|
155
|
-
} catch (Exception e) {
|
156
|
-
Log.d("publisherViewContainer", e.toString());
|
157
|
-
}
|
158
|
-
|
149
|
+
} catch (Exception e) {}
|
159
150
|
if (publisher.getView() instanceof GLSurfaceView) {
|
160
151
|
((GLSurfaceView) publisher.getView()).setZOrderOnTop(true);
|
161
152
|
}
|
162
|
-
|
163
153
|
session.publish(publisher);
|
164
154
|
}
|
165
|
-
|
166
155
|
@Override
|
167
156
|
public void onDisconnected(Session session) {
|
168
157
|
notifyObservers("deny");
|
169
158
|
if(publisher!=null) {
|
170
|
-
|
171
159
|
publisher.setPublishAudio(false);
|
172
160
|
imageViewMute.setImageResource(R.drawable.microphoneoff);
|
173
|
-
|
174
161
|
}
|
175
162
|
if(publisher!=null) {
|
176
|
-
|
177
163
|
publisher.setPublishVideo(false);
|
178
164
|
imageViewCamOff.setImageResource(R.drawable.cameraoff);
|
179
165
|
imageViewCamSwitch.setVisibility(View.GONE);
|
180
|
-
|
181
|
-
|
182
|
-
|
183
166
|
}
|
184
167
|
VideoCallActivity temp = new VideoCallActivity();
|
185
168
|
temp.session = null;
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
Log.d(TAG, "onDisconnected: Disconnected from session: " + session.getSessionId());
|
190
|
-
if (publisher != null) {
|
169
|
+
isTimeron=false;
|
170
|
+
if (publisher != null) {
|
191
171
|
publisher = null;
|
192
172
|
publisherViewContainer.removeAllViews();
|
193
173
|
}
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
// setResult(RESULT_CANCELED); // Use this to indicate cancellation
|
205
|
-
|
206
|
-
|
207
|
-
finish();
|
174
|
+
Intent resultIntent = new Intent();
|
175
|
+
String resultcode = "";
|
176
|
+
if(isEndall){
|
177
|
+
resultcode= "111";
|
178
|
+
}else{
|
179
|
+
resultcode = ISPROVIDER ? "999" : "888";
|
180
|
+
}
|
181
|
+
resultIntent.putExtra("result_key", resultcode);
|
182
|
+
setResult(RESULT_OK, resultIntent);
|
183
|
+
finish();
|
208
184
|
}
|
209
|
-
|
210
185
|
@Override
|
211
186
|
public void onStreamReceived(Session session, Stream stream) {
|
212
187
|
|
213
|
-
Log.d(TAG, "onStreamReceived: New Stream Received " + stream.getStreamId() + " in session: " + session.getSessionId());
|
214
188
|
ProviderViewLayout = findViewById(R.id.providerViewLayout);
|
215
189
|
if(ISPROVIDER) {
|
216
190
|
ProviderViewLayout.setVisibility(View.VISIBLE);
|
217
191
|
}
|
218
192
|
circleAvatar.setVisibility(View.GONE); // Hide the view
|
219
193
|
patientStatus.setVisibility(View.GONE); // Hide the view
|
220
|
-
publishernameView.setVisibility(View.GONE)
|
221
|
-
|
194
|
+
publishernameView.setVisibility(View.GONE);// Hide the view
|
195
|
+
admit.setVisibility(View.GONE);
|
196
|
+
deny.setVisibility(View.GONE);
|
197
|
+
sendNotifications.setVisibility(View.GONE);
|
222
198
|
|
223
199
|
if (subscriber == null) {
|
224
200
|
subscriber = new Subscriber.Builder(VideoCallActivity.this, stream).build();
|
@@ -228,22 +204,14 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
|
|
228
204
|
session.subscribe(subscriber);
|
229
205
|
try {
|
230
206
|
subscriberViewContainer.addView(subscriber.getView());
|
231
|
-
} catch (Exception e) {
|
232
|
-
Log.d("subscriberViewContainer", e.toString());
|
233
|
-
|
234
|
-
}
|
207
|
+
} catch (Exception e) {}
|
235
208
|
showToast(SUBSCRIBERNAME + "joined the call");
|
236
|
-
|
237
209
|
}
|
238
210
|
}
|
239
211
|
|
240
212
|
@Override
|
241
213
|
public void onStreamDropped(Session session, Stream stream) {
|
242
|
-
|
243
|
-
Log.d(TAG, "onStreamDropped: Stream Dropped: " + stream.getStreamId() + " in session: " + session.getSessionId());
|
244
|
-
|
245
|
-
circleAvatar.setVisibility(View.VISIBLE); // Show the view
|
246
|
-
|
214
|
+
circleAvatar.setVisibility(View.VISIBLE); // Show the view
|
247
215
|
if(!ISPROVIDER){
|
248
216
|
if(session!=null){
|
249
217
|
session.disconnect();
|
@@ -273,6 +241,20 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
|
|
273
241
|
finishWithMessage("Session error: " + opentokError.getMessage());
|
274
242
|
}
|
275
243
|
};
|
244
|
+
SubscriberKit.AudioStatsListener aaa = new SubscriberKit.AudioStatsListener(){
|
245
|
+
@Override
|
246
|
+
public void onAudioStats(SubscriberKit subscriberKit, SubscriberKit.SubscriberAudioStats subscriberAudioStats) {
|
247
|
+
|
248
|
+
}
|
249
|
+
};
|
250
|
+
SubscriberKit.AudioLevelListener sss = new SubscriberKit.AudioLevelListener(){
|
251
|
+
|
252
|
+
@Override
|
253
|
+
public void onAudioLevelUpdated(SubscriberKit subscriberKit, float v) {
|
254
|
+
|
255
|
+
}
|
256
|
+
};
|
257
|
+
|
276
258
|
SubscriberKit.VideoListener videoListener = new SubscriberKit.VideoListener() {
|
277
259
|
|
278
260
|
@Override
|
@@ -424,7 +406,8 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
|
|
424
406
|
}else{
|
425
407
|
ProviderViewLayout.setVisibility(View.GONE);
|
426
408
|
}
|
427
|
-
|
409
|
+
String dummyImage = profilePicApiUrl.length()>10?profilePicApiUrl:dummyProfile;
|
410
|
+
new urltoSource((ImageView) findViewById(R.id.image_view)).execute(dummyImage);
|
428
411
|
initializeSession(API_KEY,SESSION_ID , TOKEN);
|
429
412
|
|
430
413
|
}
|
@@ -474,8 +457,6 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
|
|
474
457
|
if(session!=null){
|
475
458
|
session.disconnect();
|
476
459
|
}
|
477
|
-
// session.cl=
|
478
|
-
|
479
460
|
}
|
480
461
|
});
|
481
462
|
|
File without changes
|
@@ -50,9 +50,10 @@ public class vonagePlugin extends Plugin{
|
|
50
50
|
@PluginMethod(returnType = PluginMethod.RETURN_CALLBACK)
|
51
51
|
public void setPatientOnlineStatus(PluginCall call) {
|
52
52
|
final Boolean isOnline = call.getBoolean("isOnline");
|
53
|
-
|
53
|
+
showLog("isOnline");
|
54
|
+
showLog(isOnline.toString());
|
54
55
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
55
|
-
|
56
|
+
|
56
57
|
Runnable myRunnable = new Runnable() {
|
57
58
|
@Override
|
58
59
|
public void run() {
|
@@ -121,6 +122,8 @@ public class vonagePlugin extends Plugin{
|
|
121
122
|
intent.putExtra("isProvider", ISPROVIDER);
|
122
123
|
intent.putExtra("isPatientOnline", isPatientOnline);
|
123
124
|
intent.putExtra("profilePicApiUrl", profilePicApiUrl);
|
125
|
+
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
126
|
+
|
124
127
|
|
125
128
|
Handler handler = new Handler();
|
126
129
|
int delayMillis = 2000;
|
@@ -134,7 +137,7 @@ public class vonagePlugin extends Plugin{
|
|
134
137
|
}, delayMillis);
|
135
138
|
|
136
139
|
eventData.put("isProvider", isProvid);
|
137
|
-
|
140
|
+
|
138
141
|
endPluginCal.resolve(eventData);
|
139
142
|
this.startActivityForResult(call, intent, "onAcitivtyClosed");
|
140
143
|
call.setKeepAlive(false);
|
@@ -148,8 +151,7 @@ public class vonagePlugin extends Plugin{
|
|
148
151
|
JSObject eventData1 = new JSObject();
|
149
152
|
eventData1.put("key", "value test value");
|
150
153
|
eventData1.put("isProvider", isProvid);
|
151
|
-
|
152
|
-
showLog(eventData1.toString());
|
154
|
+
|
153
155
|
handler.postDelayed(new Runnable() {
|
154
156
|
@Override
|
155
157
|
public void run() {
|
@@ -238,7 +240,7 @@ public class vonagePlugin extends Plugin{
|
|
238
240
|
// session.connect(token);
|
239
241
|
// }
|
240
242
|
private void showLog(String log){
|
241
|
-
Log.d(Tag,log);
|
243
|
+
// Log.d(Tag,log);
|
242
244
|
}
|
243
245
|
private void test(PluginCall call){
|
244
246
|
JSObject eventData = new JSObject();
|
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
|
File without changes
|
File without changes
|
File without changes
|
@@ -58,7 +58,7 @@
|
|
58
58
|
android:layout_height="wrap_content"
|
59
59
|
android:layout_gravity="bottom|start"
|
60
60
|
android:paddingBottom="100dp"
|
61
|
-
android:
|
61
|
+
android:paddingStart="10dp"
|
62
62
|
android:text="00:00:00"
|
63
63
|
android:visibility="visible"
|
64
64
|
android:textColor="@android:color/white"
|
@@ -70,10 +70,8 @@
|
|
70
70
|
android:layout_height="120dp"
|
71
71
|
android:layout_gravity="bottom|end"
|
72
72
|
android:layout_marginEnd="16dp"
|
73
|
-
android:layout_marginRight="16dp"
|
74
73
|
android:layout_marginBottom="80dp"
|
75
74
|
android:background="#9b9c98"
|
76
|
-
android:layout_below="@id/publisherName"
|
77
75
|
|
78
76
|
android:padding="2dp" >
|
79
77
|
<TextView
|
File without changes
|
File without changes
|
package/android/src/main/res.zip
CHANGED
File without changes
|
@@ -48,7 +48,7 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
|
|
48
48
|
var timerLabel = UILabel()
|
49
49
|
var subscriberImg = UIImageView()
|
50
50
|
var counter = 0
|
51
|
-
var timer
|
51
|
+
var timer : Timer?
|
52
52
|
var activityView: UIActivityIndicatorView?
|
53
53
|
override func viewDidLoad() {
|
54
54
|
|
@@ -171,15 +171,23 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
|
|
171
171
|
NotificationCenter.default.removeObserver(self, name: NSNotification.Name("EndVideoCall"), object: nil)
|
172
172
|
}
|
173
173
|
func startTimer(){
|
174
|
-
if(timer != nil && timer.isValid){
|
175
|
-
timer.invalidate()
|
174
|
+
// if(timer != nil && timer.isValid){
|
175
|
+
// timer.invalidate()
|
176
|
+
// }
|
177
|
+
if let timerObj = timer, timerObj.isValid{
|
178
|
+
timer?.invalidate()
|
176
179
|
}
|
177
180
|
timer = Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(timerAction), userInfo: nil, repeats: true)
|
178
181
|
}
|
179
182
|
func stopTimer(){
|
180
|
-
if(timer != nil && timer.isValid){
|
181
|
-
timer.invalidate()
|
183
|
+
// if(timer != nil && timer.isValid){
|
184
|
+
// timer.invalidate()
|
185
|
+
// counter = 0
|
186
|
+
// }
|
187
|
+
if let timerObj = timer, timerObj.isValid{
|
188
|
+
timer?.invalidate()
|
182
189
|
counter = 0
|
190
|
+
timer = nil
|
183
191
|
}
|
184
192
|
|
185
193
|
}
|