@@ -21,12 +21,15 @@ class VideoCallViewController: UIViewController, DirectCallDataSource {
21
21
@IBOutlet weak var callStatusLabel : UILabel !
22
22
@IBOutlet weak var mutedStateLabel : UILabel ! {
23
23
didSet {
24
- self . mutedStateLabel. text = " \( self . call. remoteUser? . userId ?? " Remote user " ) is on mute "
24
+ guard let remoteUser = self . call. remoteUser else { return }
25
+ let name = remoteUser. nickname? . isEmptyOrWhitespace == true ? remoteUser. userId : remoteUser. nickname!
26
+ self . mutedStateLabel. text = " \( name) is on mute "
25
27
}
26
28
}
27
- @IBOutlet weak var remoteUserIdLabel : UILabel ! {
29
+ @IBOutlet weak var remoteNicknameLabel : UILabel ! {
28
30
didSet {
29
- self . remoteUserIdLabel. text = self . call. remoteUser? . userId
31
+ let nickname = self . call. remoteUser? . nickname
32
+ self . remoteNicknameLabel. text = nickname? . isEmptyOrWhitespace == true ? self . call. remoteUser? . userId : nickname
30
33
}
31
34
}
32
35
@@ -77,7 +80,7 @@ class VideoCallViewController: UIViewController, DirectCallDataSource {
77
80
}
78
81
79
82
// Constraints of remote user ID
80
- @IBOutlet weak var topSpaceRemoteUserId : NSLayoutConstraint !
83
+ @IBOutlet weak var topSpaceRemoteNickname : NSLayoutConstraint !
81
84
82
85
var call : DirectCall !
83
86
var isDialing : Bool ?
@@ -112,9 +115,9 @@ class VideoCallViewController: UIViewController, DirectCallDataSource {
112
115
func setupEndedCallUI( ) {
113
116
// Tell user that the call has been ended.
114
117
self . callStatusLabel. text = " Call Ended "
115
- self . topSpaceRemoteUserId . constant = 244
118
+ self . topSpaceRemoteNickname . constant = 244
116
119
self . callStatusLabel. isHidden = false
117
- self . remoteUserIdLabel . isHidden = false
120
+ self . remoteNicknameLabel . isHidden = false
118
121
self . remoteProfileImageView. isHidden = false
119
122
120
123
// Release resource
@@ -286,7 +289,7 @@ extension VideoCallViewController {
286
289
extension VideoCallViewController : DirectCallDelegate {
287
290
// MARK: Required Methods
288
291
func didConnect( _ call: DirectCall ) {
289
- self . remoteUserIdLabel . isHidden = true
292
+ self . remoteNicknameLabel . isHidden = true
290
293
self . callStatusLabel. isHidden = true
291
294
self . updateRemoteAudio ( isEnabled: call. isRemoteAudioEnabled)
292
295
@@ -329,5 +332,8 @@ extension VideoCallViewController: DirectCallDelegate {
329
332
self . audioRouteButton. setBackgroundImage ( . audio( output: output. portType) ,
330
333
for: . normal)
331
334
print ( " [QuickStart] Audio Route has been changed to \( output. portName) " )
335
+
336
+ // Disable to display `AVAudioPickerView` (also `MPVolumeView`) when it is speaker mode.
337
+ self . audioRouteButton. isEnabled = output. portType != . builtInSpeaker
332
338
}
333
339
}
0 commit comments