2015-09-28 24 views
1

在我的应用程序中,我正在实施用于音频和视频通话的quickblox api。 CallViewController里面我有一个计时器,它是callTimer。现在在我的应用程序中,我希望用户只在有限的时间内拨打电话。这段时间只有30分钟。所以当2个用户在通话时,我想让我的计时器反向传输。有人可以告诉我。在通话开始前我应该如何设置计时器。在quickblox中设置视频通话时间

回答

1

如果你想有一个电话让我们说5分钟,那么你的代码应该是这样的:

(我们使用视频通话ObjC聊天代码示例作为基础http://quickblox.com/developers/Sample-webrtc-ios

#pragma mark - 
#pragma mark QBRTCClientDelegate 

- (void)session:(QBRTCSession *)session connectedToUser:(NSNumber *)userID { 

    NSLog(@"Connection with user %@ is established", userID); 

    [NSTimer scheduledTimerWithTimeInterval:600.0 
     target:self 
     selector:@selector(videoCallTimeOut:) 
     userInfo:nil 
     repeats:NO]; 
} 

- (void)videoCallTimeOut:(id)timer{ 
    [self.session hangUp:userInfo]; 
} 

#pragma mark - 
#pragma mark QBRTCClientDelegate 

- (void)session:(QBRTCSession *)session hungUpByUser:(NSNumber *)userID userInfo:(NSDictionary *)userInfo { 


}