actionMeeting Unmute returns ZoomSDKError_WrongUsage

Description
I copied following code from your sample:

let ret = meetingActionController?.actionMeeting(
  with: ActionMeetingCmd_UnMuteAudio, 
  userID: 0, 
  on: ScreenType_First
)

Unfortunately it doesn’t work - my user is still muted and the method returns ZoomSDKError_WrongUsage error.

Do you have a clue what can cause this problem?
My app connects to a meeting without any problem.

Which version?
v4.6.21666.0427

Smartphone (please complete the following information):

  • Device: MacBook
  • OS: macOS 10.15.2 (19C57)

Additional context
The app is very simple. Just connecting using sdk and joining to meeting like:

let sdk: ZoomSDK = ZoomSDK.shared()
let meetingService = sdk.getMeetingService()
sdk.getSettingService()?.getAudioSetting()?.enableAutoJoinVoip(true)

meetingService?.joinMeeting(
    ZoomSDKUserType_APIUser, 
    toke4enfrocelogin: nil, 
    webinarToken: nil, 
    participantId: nil, 
    meetingNumber: "...", 
    displayName: "...", 
    password: "...", 
    isDirectShare: false, 
    sharedApp: 0, 
    isVideoOff: false, 
    isAuidoOff: false, 
    vanityID: nil
)

And then trying to call the actionMeeting, but no luck :frowning:

UPDATE

We’ve migrated the code from Swift to ObjC and copied parts directly from the sample application. Still same error, and still no clues what this SDK is expecting:

#import "ViewController.h"

#define kZoomSDKDomain      @"zoom.us"
#define kZoomSDKKey         @"..."
#define kZoomSDKSecret      @"..."
#define kSDKUserName        @"Bobin"

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    BOOL useCustomizedUI = NO;
    ZoomSDK* sdk = [ZoomSDK sharedSDK];
    
    NSString* domain = kZoomSDKDomain;
    NSString* key = kZoomSDKKey;
    NSString* secret = kZoomSDKSecret;
    
    [sdk initSDK:useCustomizedUI];
    [sdk setZoomDomain:domain];
    
    ZoomSDKError ret = [[sdk getAuthService] sdkAuth:key appSecret:secret];
}

- (IBAction)joinClicked:(id)sender {
    ZoomSDKMeetingService* meetingService = [[ZoomSDK sharedSDK] getMeetingService];
    
    NSString* userName = kSDKUserName;
    NSString* pwd = @"...";
    NSString* meetingNumber = @"...";
    
    ZoomSDKError ret = [meetingService joinMeeting:ZoomSDKUserType_APIUser
                                 toke4enfrocelogin:nil
                                      webinarToken:nil
                                     participantId:nil
                                     meetingNumber:meetingNumber
                                       displayName:userName
                                          password:pwd
                                     isDirectShare:NO
                                         sharedApp:0
                                        isVideoOff:NO
                                        isAuidoOff:NO
                                          vanityID:nil];
}

- (IBAction)unmuteClicked:(id)sender {
    ZoomSDKMeetingService* meetingService = [[ZoomSDK sharedSDK] getMeetingService];
    
    ZoomSDKError* result = [[meetingService getMeetingActionController] actionMeetingWithCmd:ActionMeetingCmd_UnMuteAudio userID:0 onScreen:ScreenType_First];
    // result is ZoomSDKError_WrongUsage :-(((
}
@end
1 Like

Hi, you can get the user info of yourself by passing in 0 as the user id. However, it is my understanding that you need to pass in the real user id when using other functions like the unmute function.

Hi @sam.decrock,

Yes, I’m trying to mute/unmute myself. I also tried another version of this code where I passed my user’s id, but still no luck :frowning:

I’m wondering why it works correctly in the sample code, but not in mine. I’m trying to make the example as simple as possible in order to figure it out but I can’t notice any difference…

Unfortunately the ZoomSDKError_WrongUsage alone does not give us, developers, a lot of feedback…

1 Like

The sample code is Objective C, right?
Can you write up how you integrated it with Swift? I would love to work on a Swift version of my Windows integration.

Anyway, in C#, I have to mute myself with:

var me = participantsController.GetUserByUserID(0);
audioController.MuteAudio(me.GetUserID(), true);

Only passing in 2 arguments to a function of the audiocontroller. I don’t see what the third parameter is you are using…

Btw, did you wait until you are in the meeting before sending the command?

Wait for onMeetingStatusChange to go to ZoomSDKMeetingStatus_InMeeting that is?

Hey @sam.decrock

I initially implemented it in Swift by creating brider h file in Xcode, but your comment suggested me, that maybe that’s the problem, so I recreated my code in ObjC as you can see in the updated original post - the code I pasted above is actually whole application so not much room to make mistake or overlook something…

Thanks for your suggestion, but I can’t use the participantsController in macOS version. I’m trying to mute the mic using exactly the same way as in the macOS sample code.

1 Like

@sam.decrock Thanks for helping out! :slight_smile:

Hi @dmiskiew,

Thanks for the code snippet. If you would like to unmute yourself, you will need to pass a real userID, passing 0 will not work. And the ActionMeetingCmd needs to be called if and only if you are in the meeting.

Hope this helps. Thanks!

Thanks for the answer @carson.zoom!
As I mentioned couple posts earlier I tried with real user ID, but it didn’t help.
But I finally figured it out by deleting line by line from the sample code.

The ZoomSDKError_WrongUsage is returned if there’s no ZoomSDKMeetingServiceDelegate.
Connecting the delegate with onMeetingStatusChange, onWaitMeetingSessionKey etc solved this and other problems.

1 Like