400-881-9892

文档中心

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

文档中心 互动课堂

Play Desktop Sharing And Movie File Streams

    playScreen
    • A brief description - Play screen sharing

    This interface is specifically used for playing the screen sharing stream shared by users. When receiving the callback: - (void)onShareScreenState(String peerId, int state, Map attrs), it indicates that a user has published screen sharing, and you can call this interface to play it.

    • Interface Name

    - (int)playScreen(String peerId, Object view);

    • Parameters
    Parameter Name Required Type Description
    peerID Yes string User ID
    view Yes Object The window for rendering video
    • Method Example
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
     //The global eglbase
     EglBase eglBase = EglBase.create();
     //Create a renderer
     TkSurfaceViewRenderer createRender() {
        TkSurfaceViewRenderer renderer  = new TkSurfaceViewRenderer(this);
        try {
            renderer.init(eglBase.getEglBaseContext(), null);
        } catch (Exception e) {
            //Release the renderer
            renderer.release();
            //Release and recreate
            eglBase.release();
            eglBase = EglBase.create();
            //Reinitialize the renderer
            renderer.init(eglBase.getEglBaseContext(), null);
        }
        return renderer;}
        TKRoomManager.getInstance().playScreen("123", createRender());
    

    -Return Value Description

    Type Description
    int 0: Indicates successful invocation; Non-zero: Indicates invocation failure
    unPlayScreen
    • A brief description - Stop playing screen sharing

    This interface is specifically used to stop playing the screen sharing stream shared by users

    • Interface Name
    1
    2
    3
    4
    5
    6
    7
     - (int)unPlayScreen(String peerId);
    
    <font size=2.5>**parameters**</font></br>
    |parameter name|required|type|description||:----|:-----|:----- |:----- || peerID |Yes| String | User ID |
    <font size=2.5>**method example*</font></br>
     ```java
        TKRoomManager.getInstance().unPlayScreen(peerId);
    
    • Return Value Description
    Type Description
    int 0: Indicates successful invocation; Non-zero: Indicates invocation failure
    playFile
    • A brief description - Play the movie file shared by the user

    This interface is specifically used for playing the movie file stream shared by users. When receiving the callback: - (void)onShareFileState(String peerId, int state, Map attrs), it indicates that a user has published a shared movie, and you can call this interface to play it

    • Interface Name

    - (int)playFile(String peerId, Object view);

    • Parameters
    Parameter Name Required Type Description
    peerID Yes string User ID
    view Yes Object Render video window
    • Method Example
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
       //The global eglbase
     EglBase eglBase = EglBase.create();
     //Create a renderer
     TkSurfaceViewRenderer createRender() {
        TkSurfaceViewRenderer renderer  = new TkSurfaceViewRenderer(this);
        try {
            renderer.init(eglBase.getEglBaseContext(), null);
        } catch (Exception e) {
            //Release the renderer
            renderer.release();
            //Release and recreate 
            eglBase.release();
            eglBase = EglBase.create();
            //Reinitialize the renderer
            renderer.init(eglBase.getEglBaseContext(), null);
        }
        return renderer;}
        TKRoomManager.getInstance().playFile("123", createRender());
    

    -Return Value Description

    Type Description
    int 0: Indicates successful invocation; Non-zero: Indicates invocation failure
    unPlayFile
    • A brief description - Stop playing the movie file shared by the user

    This interface is specifically used to stop playing the movie file stream shared by users

    • Interface Name

    - (int)unPlayFile(String peerId);

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

    TKRoomManager.getInstance().unPlayFile(peerId);

    -Return Value Description

    Type Description
    int 0: Indicates successful invocation; Non-zero: Indicates invocation failure