SKInCallViewController.m 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. //
  2. // InCallViewController.m
  3. // JCSampleOC
  4. //
  5. // Created by Ginger on 2017/10/12.
  6. // Copyright © 2017年 juphoon. All rights reserved.
  7. //
  8. #import "SKInCallViewController.h"
  9. #import "SKInCallViewController+juphoon.h"
  10. #import "SKInCallViewController+agora.h"
  11. #import "SKInCallViewController+time.h"
  12. #import "SKInCallViewController+touch.h"
  13. #import "VideoManager+ringtone.h"
  14. @implementation SKInCallViewController
  15. - (void)viewDidLoad {
  16. [super viewDidLoad];
  17. [[UIApplication sharedApplication] setIdleTimerDisabled:YES];
  18. _smallView = nil;
  19. [self initView];
  20. [self updateUI:nil];
  21. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateUI:) name:kCallNotification object:nil];
  22. [[VideoManager shared] playVideoWaitingRingtone];
  23. }
  24. - (void)initView {
  25. [EUtil setViewShadow:self.mWaitNameLabel color:[UIColor colorWithRed:0/255.0f green:1/255.0f blue:75/255.0f alpha:0.2] offset:CGSizeMake(0, 2) opacity:1 radius:4];
  26. [EUtil setViewShadow:self.mWaitOutHintLabel color:[UIColor colorWithRed:0/255.0f green:1/255.0f blue:75/255.0f alpha:0.2] offset:CGSizeMake(0, 2) opacity:1 radius:4];
  27. [EUtil setViewShadow:self.mWaitInHintLabel color:[UIColor colorWithRed:0/255.0f green:1/255.0f blue:75/255.0f alpha:0.2] offset:CGSizeMake(0, 2) opacity:1 radius:4];
  28. [EUtil setViewShadow:self.mIngNameLabel color:[UIColor colorWithRed:0/255.0f green:1/255.0f blue:75/255.0f alpha:0.2] offset:CGSizeMake(0, 2) opacity:1 radius:4];
  29. [EUtil setViewShadow:self.mIngTimeLabel color:[UIColor colorWithRed:0/255.0f green:1/255.0f blue:75/255.0f alpha:0.2] offset:CGSizeMake(0, 2) opacity:1 radius:4];
  30. [EUtil setViewShadow:self.mIngNetWorkLabel color:[UIColor colorWithRed:0/255.0f green:1/255.0f blue:75/255.0f alpha:0.2] offset:CGSizeMake(0, 2) opacity:1 radius:4];
  31. [EUtil setURLImage:self.mWaitHeadImage placeHolderName:@"avatar" imageURL:[[VideoManager shared] getTalkHeadImageURL] cornerRadius:self.mWaitHeadImage.frame.size.width/2];
  32. }
  33. - (void)viewWillAppear:(BOOL)animated {
  34. [super viewWillAppear:animated];
  35. [self.navigationController setNavigationBarHidden:YES animated:NO];
  36. }
  37. - (void)viewDidAppear:(BOOL)animated {
  38. [[VideoManager shared].mJuphoonMediaDevice enableSpeaker:YES];
  39. }
  40. - (void)viewWillDisappear:(BOOL)animated {
  41. [super viewWillDisappear:animated];
  42. [self.navigationController setNavigationBarHidden:NO animated:NO];
  43. [self stopTimer];
  44. self.mIngTimeLabel.text = @"";
  45. self.mIngNetWorkLabel.text = @"";
  46. }
  47. - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
  48. return UIInterfaceOrientationMaskPortrait;
  49. }
  50. - (void)dealloc {
  51. [[NSNotificationCenter defaultCenter] removeObserver:self];
  52. [[UIApplication sharedApplication] setIdleTimerDisabled:NO];
  53. [[VideoManager shared] playVideoFinishRingtone];
  54. }
  55. #pragma mark - Incoming Actions
  56. - (IBAction)endCall:(id)sender {
  57. //通话中挂断; 自己发起时,对方未接通,自己挂断//
  58. [[VideoManager shared] videoEnd:NO isSendMessage:YES];
  59. }
  60. - (IBAction)endCallWhenIncoming:(id)sender {
  61. //对方发起时,自己拒接//
  62. [[VideoManager shared] videoEnd:YES isSendMessage:YES];
  63. }
  64. - (IBAction)videoAnswer:(id)sender {
  65. JCCallItem *activeCall = [[VideoManager shared] getActiveCall];
  66. [[VideoManager shared].mJuphoonCall answer:activeCall video:true];
  67. }
  68. - (IBAction)voiceAnswer:(id)sender {
  69. JCCallItem *activeCall = [[VideoManager shared] getActiveCall];
  70. [[VideoManager shared].mJuphoonCall answer:activeCall video:false];
  71. }
  72. #pragma mark - In Calling Actions
  73. - (IBAction)setCameraState:(id)sender {
  74. JCCallItem *activeCall = [[VideoManager shared] getActiveCall];
  75. [[VideoManager shared].mJuphoonCall enableUploadVideoStream:activeCall];
  76. }
  77. - (IBAction)addNewCall:(id)sender {
  78. }
  79. - (IBAction)switchCamera:(id)sender {
  80. [[VideoManager shared].mJuphoonMediaDevice switchCamera];
  81. }
  82. - (IBAction)hold:(id)sender {
  83. JCCallItem *activeCall = [[VideoManager shared] getActiveCall];
  84. [[VideoManager shared].mJuphoonCall hold:activeCall];
  85. }
  86. - (IBAction)mute:(id)sender {
  87. JCCallItem *activeCall = [[VideoManager shared] getActiveCall];
  88. [[VideoManager shared].mJuphoonCall mute:activeCall];
  89. }
  90. - (IBAction)audioRecord:(id)sender {
  91. }
  92. - (IBAction)videoRecord:(id)sender {
  93. }
  94. - (IBAction)snapshot:(id)sender {
  95. }
  96. - (IBAction)speaker:(id)sender {
  97. BOOL isOn = [VideoManager shared].mJuphoonMediaDevice.isSpeakerOn;
  98. [[VideoManager shared].mJuphoonMediaDevice enableSpeaker:!isOn];
  99. self.speakerBtn.selected = isOn;
  100. }
  101. - (IBAction)callStatistics:(id)sender {
  102. }
  103. @end