On this page

Show all

SDK Usage

Updated on 2025-02-21 GMT+08:00
  1. Create a container.

    <body>
        <div id='preview' style='width:1280px; height:720px'>
        </div>
    </body>

  2. Create a client by referring to createClient.

    const client = HWLLSPlayer.createClient()

  3. Enter the stream URL and container ID to start playback. See startPlay.

    const streamUrl = 'webrtc://domain/appname/streamname'
    client.startPlay(streamUrl, {
        elementId: 'preview', // (Mandatory) Container ID. Generally, the ID of the div tag is transferred. Here, the ID of the div container in step 1 is entered.
    })
    client.on('Error', (errorInfo)=>{
        // Listen on and handle playback errors.
        console.log(`Something error: ${errorInfo.getMsg()}`)
    })

    For details about the error, see Client Error Codes.

  4. Stop the playback by referring to stopPlay.

    client.stopPlay()

  5. Release resources by referring to destroyClient.

    client.destroyClient()

    See Advanced Usage.

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback