400-881-9892

文档中心

官方文档,可查阅产品介绍、快速入门、用户指南、开发指南、API参考、SDK参考、帮助等信息。

文档中心 互动课堂

TKRoomUser

    TKRoomUser class

    Description Type
    Inherits from NSObject
    Declared in TKRoomUser.h

    Overview

    User Instance Object Class

    Properties
    peerID

    User ID @property (nonatomic, copy) NSString *peerID;

    nickName

    User Nickname @property (nonatomic, copy) NSString *nickName;

    role

    User Role:0: Teacher 1: Teaching Assistant 2: Student 3: Auditor 4: Hidden User @property (nonatomic, assign) TKUserRoleType role;

    hasAudio

    Whether the user has enabled audio device permissions @property (nonatomic, assign) BOOL hasAudio;

    hasVideo

    Whether the user has enabled video device permissions @property (nonatomic, assign) BOOL hasVideo;

    canDraw

    Whether the user has the permission to draw on the whiteboard and documents @property (nonatomic, assign) BOOL canDraw;

    publishState

    User's publishing status:0: Not published 1: Publishing audio 2: Publishing video 3: Publishing audio and video @property (nonatomic, assign) TKPublishState publishState;

    properties

    User Attributes @property (nonatomic, strong) NSMutableDictionary *properties;

    disableVideo

    Whether the user has disabled the video device @property (nonatomic, assign) BOOL disableVideo;

    disableAudio

    Whether the user has disabled the audio device @property (nonatomic, assign) BOOL disableAudio;

    Instance Methods
    initWithPeerId
    • Brief Description

    Initialize a user

    • Interface Name

    - (instancetype)initWithPeerId:(NSString *)peerID;

    • Parameters
    Parameter Name Required Type Description
    peerID Yes NSString User ID
    • Method Example

    TKRoomUser *user = [[TKRoomUser alloc] initWithPeerId:peerId]];

    • Return Value Description
    Type Description
    TKRoomUser User instance object
    initWithPeerId
    • Brief Description

    Initialize a user

    • Interface Name

    - (instancetype)initWithPeerId:(NSString *)peerID; - (instancetype)initWithPeerId:(NSString *)peerID AndProperties:(NSDictionary*)properties;

    • Parameters
    Parameter Name Required Type Description
    peerID Yes NSString User ID
    properties Yes NSDictionary User Attributes
    • Method Example

    TKRoomUser *user = [[TKRoomUser alloc] initWithPeerId:peerId]];TKRoomUser *user = [[TKRoomUser alloc] initWithPeerId:peerId AndProperties:@{@"role":@2}];

    • Return Value Description
    Type Description
    TKRoomUser User instance object
    getPublishStateForDeviceId
    • Brief Description

    Get the video publishing status of a specific video device (the user's device supports multiple cameras and has enabled multi-stream functionality)

    • Interface Name

    - (TKPublishState)getPublishStateForDeviceId:(NSString *)deviceId;

    • Parameters
    Parameter Name Required Type Description
    deviceId Yes NSString Video Device ID
    • Method Example

    TKPublishState state = [_user getPublishStateForDeviceId:@"ad-d123"];

    • Return Value Description
    Type Description
    TKPublishState Publishing Status
    getCameraTypeWithDeviceID
    • Brief Description

    When the user enables dual cameras, get whether the camera is the main camera (@"tk_maincamera") or the secondary camera (@"tk_vicecamera")

    • Interface Name

    - (NSString *)getCameraTypeWithDeviceID:(NSString *)deviceId;

    • Parameters
    Parameter Name Required Type Description
    deviceId Yes NSString Video Device ID
    • Method Example

    NSString *maincamera = [_user getCameraTypeWithDeviceID:@"ad-d123"];

    • Return Value Description
    Type Description
    NSString @"tk_maincamera" indicates the main camera
    enableDualStream
    • Brief Description

    Whether multi-bitrate streaming is enabled

    • Interface Name

    - (BOOL)enableDualStream;

    • Parameters

    none

    • Method Example

    BOOL ret = [_user enableDualStream];

    • Return Value Description
    Type Description
    BOOL YES: Indicates enabled. NO: Indicates not enabled