123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- //
- // SKInCallViewController+juphoon.m
- // SikeyComm
- //
- // Created by 刘振兴 on 2025/2/13.
- // Copyright © 2025 BaH Cy. All rights reserved.
- //
- #import "SKInCallViewController+juphoon.h"
- #import "SKInCallViewController+time.h"
- #import "VideoManager+ringtone.h"
- #import "VideoManager+juphoon.h"
- @implementation SKInCallViewController (juphoon)
- - (void)updateUI:(NSNotification *)notification {
- NSInteger count = [VideoManager shared].mJuphoonCall.callItems.count;
- JCCallItem *activeCall = [[VideoManager shared] getActiveCall];
- HDNormalLog(([NSString stringWithFormat:@"VideoManager: updateUI count:%ld updateUI: %ld", count, activeCall.state]));
- if (activeCall.state == JCCallStateInit || activeCall.state == JCCallStatePending) {
- self.mInVideoView.hidden = !activeCall.video || activeCall.direction == JCCallDirectionOut;
- self.mOutView.hidden = activeCall.direction != JCCallDirectionOut;
- self.mWaitHeaderView.hidden = NO;
- self.mIngHeaderView.hidden = YES;
- self.mIngView.hidden = YES;
-
- self.mIngNameLabel.text = @"";
- self.mWaitNameLabel.text = [[VideoManager shared] getTalkName];
- self.mWaitInHintLabel.hidden = activeCall.direction != JCCallDirectionIn;
- self.mWaitOutHintLabel.hidden = activeCall.direction != JCCallDirectionOut;
-
- if (activeCall.video) {
- if (self.jcLocalCanvas == nil && activeCall.uploadVideoStreamSelf) {
- self.jcLocalCanvas = [[VideoManager shared] getLocalCanvas];
- //self.jcLocalCanvas.videoView.frame = CGRectMake(SCREEN_WIDTH - 150, SCREEN_HEIGHT - 150 - 160, 120, 160);
- self.jcLocalCanvas.videoView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- [self.view insertSubview:self.jcLocalCanvas.videoView aboveSubview:self.backgroudView];
- }
- }
- } else if (activeCall.state == JCCallStateTalking) {
- self.mInVideoView.hidden = YES;
- self.mOutView.hidden = YES;
- self.mWaitHeaderView.hidden = YES;
- self.mIngHeaderView.hidden = NO;
- self.mIngView.hidden = NO;
- self.mIngNameLabel.text = [[VideoManager shared] getTalkName];
- self.switchCameraBtn.enabled = activeCall.video;
- self.holdBtn.enabled = !activeCall.held;
- self.holdBtn.selected = activeCall.hold;
- self.muteBtn.selected = activeCall.mute;
- self.speakerBtn.selected = [VideoManager shared].mJuphoonMediaDevice.isSpeakerOn;
-
- if (activeCall != nil && activeCall.audioRecord && (activeCall.hold || activeCall.held)) {
- [[VideoManager shared].mJuphoonCall audioRecord:activeCall enable:false filePath:@""];
- }
- if (activeCall != nil && activeCall.localVideoRecord && !activeCall.uploadVideoStreamSelf) {
- //[[VideoManager shared].mJuphoonCall videoRecord:activeCall enable:false remote:false width:0 height:0 filePath:@""];
- [[VideoManager shared].mJuphoonCall videoRecord:activeCall enable:false remote:false width:0 height:0 filePath:@"" bothAudio:false keyFrame:10];
- }
- if (activeCall != nil && activeCall.remoteVideoRecord && !activeCall.uploadVideoStreamOther) {
- [[VideoManager shared].mJuphoonCall videoRecord:activeCall enable:false remote:true width:0 height:0 filePath:@"" bothAudio:false keyFrame:10];
- }
- if (activeCall.video) {
- if (self.jcLocalCanvas != nil && activeCall.uploadVideoStreamSelf) {
- if (self.smallView == nil) {
- self.jcLocalCanvas.videoView.frame = CGRectMake(SCREEN_WIDTH - 130, SCREEN_STATUS_HEIGHT+10, 120, 160);
- }
- self.smallView = self.jcLocalCanvas.videoView;
- }
-
- if (self.jcRemoteCanvas == nil && activeCall.uploadVideoStreamOther) {
- self.jcRemoteCanvas = [[VideoManager shared] getRemoteCanvas];
- self.jcRemoteCanvas.videoView.frame = self.view.frame;
- self.jcRemoteCanvas.videoView.hidden = !activeCall.uploadVideoStreamSelf;
- [self.view insertSubview:self.jcRemoteCanvas.videoView aboveSubview:self.backgroudView];
- [[VideoManager shared].mJuphoonMediaDevice enableSpeaker:YES];
- } else if (self.jcRemoteCanvas != nil && !activeCall.uploadVideoStreamOther) {
- [[VideoManager shared].mJuphoonMediaDevice stopVideo:self.jcRemoteCanvas];
- [self.jcRemoteCanvas.videoView removeFromSuperview];
- self.jcRemoteCanvas = nil;
- }
- }
- [self startTimer];
- [[VideoManager shared] stopVideoRingtone];
- } else {
- self.mInVideoView.hidden = YES;
- }
- }
- - (NSString *)getNetStatus:(JCCallItem *)item {
- if (item.state != JCCallStateTalking) {
- return @"";
- }
- switch (item.videoNetSendStatus) {
- case JCCallNetWorkDisconnected:
- return NSLocalizedString(@"Video.Network.Status.0", nil);
- case JCCallNetWorkVeryBad:
- return NSLocalizedString(@"Video.Network.Status.1", nil);
- case JCCallNetWorkBad:
- return NSLocalizedString(@"Video.Network.Status.2", nil);
- case JCCallNetWorkNormal:
- return NSLocalizedString(@"Video.Network.Status.3", nil);
- case JCCallNetWorkGood:
- return NSLocalizedString(@"Video.Network.Status.4", nil);
- case JCCallNetWorkVeryGood:
- return NSLocalizedString(@"Video.Network.Status.5", nil);
- default:
- return @"";
- }
- }
- @end
|