capacitor-plugin-vonage 0.1.0 → 0.1.1

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.
@@ -25,6 +25,7 @@ import android.widget.Button;
25
25
  import android.widget.FrameLayout;
26
26
  import android.widget.ImageView;
27
27
  import android.widget.LinearLayout;
28
+ import android.widget.ProgressBar;
28
29
  import android.widget.TextView;
29
30
  import android.widget.Toast;
30
31
 
@@ -72,13 +73,15 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
72
73
  boolean isPatientOnline = false;
73
74
  boolean isMuted = false;
74
75
  boolean isCamOff = false;
75
- boolean isCallinprogress = false;
76
+ private static boolean isCallinprogress = false;
76
77
  public boolean temptest = false;
77
78
  boolean isTimeron = false;
78
79
  boolean isEndall = false;
79
80
  private Subscriber subscriber;
80
81
  private FrameLayout publisherViewContainer;
81
82
  private LinearLayout ProviderViewLayout;
83
+ private LinearLayout main;
84
+ private ProgressBar progressBar;
82
85
  private FrameLayout subscriberViewContainer;
83
86
  private TextView publisherNameTextView;
84
87
  private FloatingActionButton fabCameraOff;
@@ -148,6 +151,8 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
148
151
  private final Session.SessionListener sessionListener = new Session.SessionListener() {
149
152
  @Override
150
153
  public void onConnected(Session session) {
154
+ main.setVisibility(View.VISIBLE);
155
+ progressBar.setVisibility(View.INVISIBLE);
151
156
  publisher = new Publisher.Builder(VideoCallActivity.this).build();
152
157
  publisher.setPublisherListener(publisherListener);
153
158
  publisher.getRenderer().setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL);
@@ -315,6 +320,7 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
315
320
  @Override
316
321
  public void onDisconnected(SubscriberKit subscriberKit) {
317
322
  Log.d(TAG, "onDisconnected: Subscriber disconnected. Stream: " + subscriberKit.getStream().getStreamId());
323
+ showToast(SUBSCRIBERNAME+" left the call");
318
324
 
319
325
 
320
326
  }
@@ -361,6 +367,8 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
361
367
 
362
368
  setContentView(R.layout.video_call_layout);
363
369
  sendNotifications = findViewById(R.id.senddata);
370
+ main = findViewById(R.id.main);
371
+ progressBar = findViewById(R.id.progressBar);
364
372
 
365
373
  circleAvatar = findViewById(R.id.image_view);
366
374
 
@@ -637,6 +645,7 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
637
645
 
638
646
 
639
647
  private void initializeSession(String apiKey, String sessionId, String token) {
648
+ instance.isCallinprogress= false;
640
649
  Log.i(TAG, "initializeSession: " + "initializeSession");
641
650
  Log.i(TAG, "apiKey: " + apiKey);
642
651
  Log.i(TAG, "sessionId: " + sessionId);
@@ -673,10 +682,10 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
673
682
  // }
674
683
 
675
684
  private void showToast(String message) {
676
- try{
677
- if(isAppInForeground()){
685
+ // try{
686
+ // if(isAppInForeground()){
678
687
  showGreenToast(getApplicationContext(),message);
679
- }
688
+ // }
680
689
  // Toast toast = Toast.makeText(this, message, Toast.LENGTH_LONG);
681
690
  // View view = toast.getView();
682
691
  // int color = Color.parseColor("#1fc600");
@@ -686,9 +695,9 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
686
695
  // text.setTextColor(Color.BLACK);
687
696
  // toast.setGravity(Gravity.TOP, 0, 0);
688
697
  // toast.show();
689
- }catch(Exception e){
690
- Log.d("toastlogex",e.toString());
691
- }
698
+ // }catch(Exception e){
699
+ // Log.d("toastlogex",e.toString());
700
+ // }
692
701
  }
693
702
 
694
703
  private void finishWithMessage(String message) {
@@ -713,7 +722,7 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
713
722
  Log.d("patientStatusChanged2", String.valueOf(isOnline));
714
723
  Log.d("patientStatusChanged2", String.valueOf(isOnline));
715
724
 
716
- if(!isCallinprogress){
725
+ if(!instance.isCallinprogress){
717
726
  runOnUiThread(new Runnable() {
718
727
  @Override
719
728
  public void run() {
@@ -15,11 +15,25 @@
15
15
  android:layout_height="match_parent"
16
16
  >
17
17
 
18
+ <ProgressBar
19
+ android:id="@+id/progressBar"
20
+ style="?android:attr/progressBarStyleLarge"
21
+ android:layout_width="57dp"
22
+ android:layout_height="56dp"
23
+ android:layout_gravity="center"
24
+ android:visibility="visible"
25
+ app:layout_constraintBottom_toBottomOf="parent"
26
+ app:layout_constraintEnd_toEndOf="parent"
27
+ app:layout_constraintStart_toStartOf="@+id/main"
28
+ app:layout_constraintTop_toTopOf="parent" />
29
+
30
+
18
31
 
19
32
  <LinearLayout
20
33
  android:id="@+id/main"
21
34
  android:layout_width="match_parent"
22
35
  android:layout_height="match_parent"
36
+ android:visibility="invisible"
23
37
  >
24
38
 
25
39
 
@@ -76,6 +90,7 @@
76
90
  android:padding="2dp" >
77
91
 
78
92
 
93
+
79
94
  </FrameLayout>
80
95
  <TextView
81
96
  android:id="@+id/subscriberName"
@@ -407,7 +407,7 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
407
407
  subscriberStatusLabel.isHidden = false
408
408
  subscriberNameLabel.isHidden = false
409
409
  subscriberStatusLabel.text = "Please Wait.."
410
- let userInfo = ["userInfo": ["isProvider": isProvider]]
410
+ let userInfo = ["isProvider": isProvider]
411
411
  // NotificationCenter.default.post(name: NSNotification.Name("SendNotification"),object: nil,userInfo: userInfo)
412
412
  delegate?.videoCallSendNotification(userInfo)
413
413
  // self.session?.disconnect(nil)
@@ -429,14 +429,14 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
429
429
  // self.session?.disconnect(nil)
430
430
  // self.stopTimer()
431
431
  // self.dismiss(animated: true, completion: nil)
432
- let userInfo = ["userInfo": ["isProvider": isProvider]]
432
+ let userInfo = ["isProvider": isProvider]
433
433
  // NotificationCenter.default.post(name: NSNotification.Name(NotificationNames.videoStarted),object: nil,userInfo: userInfo)
434
434
  delegate?.videoCallStarted(userInfo)
435
435
  }
436
436
  @objc func denybuttonClicked() {
437
437
  print("deny button clicked")
438
438
  centerView.isHidden = true
439
- let userInfo = ["userInfo": ["isProvider": isProvider]]
439
+ let userInfo = ["isProvider": isProvider]
440
440
 
441
441
  // NotificationCenter.default.post(name: NSNotification.Name(NotificationNames.videoEnded),object: nil,userInfo: userInfo)
442
442
  delegate?.videoCallEnded(userInfo)
@@ -449,7 +449,7 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
449
449
 
450
450
  @objc func callBtnbuttonClicked() {
451
451
 
452
- let userInfo = ["userInfo": ["isProvider": isProvider]]
452
+ let userInfo = ["isProvider": isProvider]
453
453
  // NotificationCenter.default.post(name: NSNotification.Name(NotificationNames.videoEnded),object: nil,userInfo: userInfo)
454
454
  delegate?.videoCallEnded(userInfo)
455
455
  self.endVonageCall()
@@ -512,7 +512,7 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
512
512
  hideActivityIndicator()
513
513
  localView.isHidden = false
514
514
  print("The client connected to the OpenTok session.")
515
- let userInfo = ["userInfo": ["isProvider": isProvider]]
515
+ let userInfo = ["isProvider": isProvider]
516
516
  // NotificationCenter.default.post(name: NSNotification.Name(NotificationNames.videoStarted),object: nil,userInfo: userInfo)
517
517
  let settings = OTPublisherSettings()
518
518
  settings.cameraResolution = .high
@@ -584,9 +584,6 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
584
584
  if(stream.videoType == .screen){
585
585
  subscriberView.accessibilityValue = "from screen"
586
586
  }
587
- adminBtn.isHidden = true
588
- denyBtn.isHidden = true
589
- sendNotificationBtn.isHidden = true
590
587
  remoteView.addSubview(subscriberView)
591
588
  }
592
589
 
@@ -600,7 +597,7 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
600
597
  // }
601
598
  if let subStream = subscriber?.stream, subStream.streamId == stream.streamId,!isProvider, stream.videoType != .screen {
602
599
  // cleanupSubscriber()
603
- let userInfo = ["userInfo": ["isProvider": isProvider]]
600
+ let userInfo = ["isProvider": isProvider]
604
601
  // NotificationCenter.default.post(name: NSNotification.Name(NotificationNames.videoEnded),object: nil,userInfo: userInfo)
605
602
  delegate?.videoCallEnded(userInfo)
606
603
  // self.session?.disconnect(nil)
@@ -646,6 +643,9 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
646
643
  subscriberNameLabel.isHidden = true
647
644
  timerLabel.textColor = .white
648
645
  isCallInProgress = true
646
+ adminBtn.isHidden = true
647
+ denyBtn.isHidden = true
648
+ sendNotificationBtn.isHidden = true
649
649
  if(subscriber.stream?.videoType != .screen){
650
650
  showToast(message: "\(subscriberName) is joined the call")
651
651
  }
@@ -688,6 +688,7 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
688
688
  }
689
689
  fileprivate func endVonageCall(){
690
690
  isCallEnded = true
691
+ self.stopTimer()
691
692
  //let userInfo = ["userInfo": ["isProvider": self.isProvider]]
692
693
  // NotificationCenter.default.post(name: NSNotification.Name("RemoveObservers"),object: nil,userInfo: userInfo)
693
694
  // DispatchQueue.main.async {
@@ -695,10 +696,14 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
695
696
  // self.publisher?.publishVideo = false
696
697
  // self.publisher?.videoCapture?.stop()
697
698
  // self.publisher?.publishAudio = false
698
- self.session?.disconnect(nil)
699
+
699
700
  // self.cleanupSubscriber()
700
701
  //self.cleanupPublisher()
701
- self.stopTimer()
702
+ var error: OTError?
703
+ self.session?.disconnect(&error)
704
+ if error != nil {
705
+ print(error!)
706
+ }
702
707
  self.dismiss(animated: true) {
703
708
  print("video ended")
704
709
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-plugin-vonage",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "opentok sdk capacitor plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",