This section describes how to implement a web client for the teacher.
This flowchart shows the major logic of the following functions:
- The teacher joins and leaves the classroom:
- The teacher mutes the audio, video, and instant messages of the students:
Integrate the SDK
Refer to the following table to download the SDKs, and integrate the SDKs into your project.
Core API call sequence
Refer to the following diagram to implement the various functions in your project with the Agora RTC SDK and RTM SDK.
Core API reference
- RTM SDK
|createInstance||Creates an RTM Client object.|
|login||Logs into the Agora RTM system.|
|createChannel||Creates an Agora RTM channel. You can create multiple channels with an RtmClient object.|
|join||Joins an Agora RTM channel.|
|getChannelAttributes||Gets the information of a specified channel.|
|queryPeersOnlineStatus||Queries the online status of a specified user.|
|MessageFromPeer||Occurs when the local user receives a message from a peer user.|
|sendMessageToPeer||Sends a message to a specified user.|
|addOrUpdateChannelAttributes||Adds or Updates the information of a specified channel. In this method, you can determine whether to notify the current update to all the users in the channel.|
|sendMessage||Sends a channel message, which can be received by all the users in the channel.|
|leave||Leaves the RTM channel.|
- RTC SDK
|createClient||Creates an RTC Client object.|
|Client.init||Initializes the RTC Client object.|
|Client.setClientRole||Sets the user role in a live broadcast. Set the role of the teacher as "host" in the Lecture Hall use case.|
|createStream||Creates a Stream object for sending and receiving audio and video.|
|Stream.init||Initializes the Stream object.|
|Client.join||Joins an Agora RTC channel.|
|Client.publish||Publishes the local audio and video stream to SD-RTN.|
|Client.on("stream-added")||Occurs when a remote audio or video stream is added to the channel.|
|Client.subscribe||Subscribes to the remote audio or video stream.|
|Stream.play||Plays the audio or video stream.|
|Client.leave||Leaves the RTC channel.|
For more features and functions available for an online class, you can refer to the following:
Monitor the network qualityUse the
on("network-quality")callback of the Agora RTC SDK to monitor the last-mile uplink and downlink network quality of every user in the channel. For more methods for reporting the real-time network quality, see the following guides:
Mute the local audio or videoCall the following methods provided by the Agora RTC SDK:
unmuteAudio, to stop or resume sending the local video stream.
unmuteVideo, to stop or resume sending the local video stream.
Mute the remote audio or videoUse both the Agora RTC SDK and Agora RTM SDK to implement this function:
sendMessageToPeeron the teacher's client to send a peer-to-peer message to the student, asking them to mute their audio or video.
- Call the corresponding
mutemethods on the student's client to mute their local audio or video.
Screen shareRefer to the following documents on screen sharing:
WhiteboardImplement the following whiteboard functions in your project:
Open-source demo project
Agora provides an open-source demo for Lecture Hall on GitHub to download as a source code reference.