400-881-9892

文档中心

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

文档中心 互动课堂

Play desktop sharing and movie file streams

    playScreen
    • Brief description

    Play screen sharing

    A dedicated interface for playing the screen-sharing stream shared by users. When receiving the callback: -(void)roomManagerOnShareScreenState:(NSString *)peerId state:(TKMediaState)state, it indicates that a user has published a screen-sharing stream, and you can call this interface to play it.

    • Interface name
    1
    2
    3
    4
    - (int)playScreen:(NSString *)peerID
            renderType:(TKRenderMode)renderType
                  window:(UIView *)window
             completion:(completion_block _Nullable)completion;
    
    • Parameter
    Parameter Name Required Type Description
    peerID Yes NSString User ID
    renderType Yes TKRenderMode Rendering Mode
    window Yes UIView Rendering window for the video
    attributes Yes NSDictionary Additional parameters, such as file ID, file name, etc
    completion No completion_block Callback for completion of the call
    • Method Example
    1
    2
    3
    4
    5
    6
        UIView *view = [[UIView alloc] initWithFrame:self.view.bounds];
        self.view addSubview:view];
        [_roomMgr playScreen:@"adc123456"
                        renderType:TKRenderMode_fit
                            window:view
                        completion:nil];
    
    • Return Value Description
    Type Description
    int 0: Indicates that the call was successful. Non-zero: Indicates that the call failed

    unPlayScreen

    • Brief description

    Stop playing the screen sharing

    A dedicated interface for stopping the playback of the screen-sharing stream shared by users

    • Interface name

    - (int)unPlayScreen:(NSString *)peerID completion:(completion_block _Nullable)completion;

    • Parameter
    Parameter Name Required Type Description
    peerID Yes NSString User ID
    completion No completion_block Callback for completion of the call
    • Method Example

    [_roomMgr unPlayScreen:@"adc123456" completion:nil];

    • Return Value Description
    Type Description
    int 0: Indicates that the call was successful. Non-zero: Indicates that the call failed

    playFile

    • Brief description

    Play the movie file shared by the user

    A dedicated interface for playing the movie file stream shared by users. When receiving the callback: -(void)roomManagerOnShareFileState:(NSString )peerId state:(TKMediaState)state extensionMessage:(NSDictionary )message; it indicates that a user has published a shared movie, and you can call this interface to play it.

    • Interface name
    1
    2
    3
    4
    - (int)playFile:(NSString *)peerID
       renderType:(TKRenderMode)renderType
             window:(UIView *)window
         completion:(completion_block _Nullable)completion;
    
    • Parameter
    Parameter Name Required Type Description
    peerID Yes NSString User ID
    renderType Yes TKRenderMode Rendering Mode
    window Yes UIView Rendering video window
    completion No completion_block Callback for completion of the call
    • Method Example
    1
    2
    3
    4
    5
    6
        UIView *view = [[UIView alloc] initWithFrame:self.view.bounds];
        self.view addSubview:view];
        [_roomMgr playScreen:@"adc123456"
                        renderType:TKRenderMode_fit
                            window:view
                        completion:nil];
    
    • Return Value Description
    Type Description
    int 0: Indicates that the call was successful. Non-zero: Indicates that the call failed

    unPlayFile

    • Brief description

    Stop playing the movie file shared by the use

    A dedicated interface for stopping the playback of the movie file stream shared by users

    • Interface name

    - (int)unPlayFile:(NSString *)peerID completion:(completion_block _Nullable)completion;

    • Parameter
    Parameter Name Required Type Description
    peerID Yes NSString User ID
    completion No completion_block Callback for completion of the call
    • Method Example

    [_roomMgr unPlayFile:@"adc123456" completion:nil];

    • Return Value Description
    Type Description
    int 0: Indicates that the call was successful. Non-zero: Indicates that the call failed

    Notes

    For more return error codes, please refer to the error code descriptions in TKRoomErrorCode