The content of this page has been automatically translated by AI. If you encounter any problems while reading, you can view the corresponding content in Chinese.
After integrating whiteboard streaming, the whiteboard streaming service will push the whiteboard screen to the specified audio and video room. If the client does not need to display the whiteboard streaming screen, please filter based on the user ID of the whiteboard streaming. Note.
Interaction Process
After integrating whiteboard streaming, the following interaction processes generally occur from the start to the end of the class:
Whiteboard Streaming
Preparing PushUserId and PushUserSig
The whiteboard stream push service needs to pull whiteboard operation signals in real-time through the IM service for whiteboard rendering. At the same time, it needs to enter the real-time audio and video room to push the whiteboard screen as the main stream into the room, so that other users can subscribe to the stream. Therefore, you need to provide a PushUserId and PushUserSig for the whiteboard stream push service to use when entering the room. For methods to generate PushUserId and PushUserSig, please refer to How to Calculate UserSig.
Notes:
PushUserSig should be set with a longer validity period, at least longer than the class duration, to avoid interruption of the whiteboard stream push due to the expiration of the signature. Note:
Start whiteboard stream push
When you need to start the whiteboard stream push, for example, when both the teacher and students are ready to start the class, you can use the Start Whiteboard Stream Push interface to notify the whiteboard stream push service to start. When requesting the interface, you need to use the PushUserId and PushUserSig prepared in the previous step.
After the whiteboard stream push starts, there will be a Stream Start event callback. It is recommended to register the event callback listener in advance. For the specific registration method, refer to Overview.
Note:
Due to network latency and other factors, the actual whiteboard streaming operation will occur approximately 2 seconds after the request is sent.
Currently, the server-side API only supports the Guangzhou region. When calling the API, please set the Region parameter to ap-guangzhou.
Stopping Whiteboard Streaming
When the class ends or you need to stop whiteboard streaming, you can use the end whiteboard streaming interface to notify the whiteboard streaming service to stop the current stream.
After whiteboard streaming starts, there will be a stream end event callback. It is recommended to register the event callback listener in advance. For specific registration methods, refer to Overview.
Note:
Due to network latency and other factors, the actual whiteboard streaming operation will be performed approximately 2 seconds after the request is sent.
Currently, the server-side API interface only supports the region: Guangzhou. When calling the API, please fill in the Region parameter as ap-guangzhou.
Whiteboard Mixing
Notes:
Whiteboard mixing relies on the cloud-based mixed-stream transcoding feature of TRTC. Using the cloud-based mixed-stream feature will incur corresponding costs. For specific billing rules, refer to Billing of On-Cloud MixTranscoding.
Generally, whiteboard streaming and other audio and video streams in the room are independent streams. The viewing end needs to subscribe to each stream separately and perform video playback according to the layout. The videos recorded by cloud recording are also independent, which greatly increases the complexity of client development and subsequent video playback generation.
By combining the capabilities of whiteboard streaming and TRTC cloud-based mixed-stream, the whiteboard video stream can be mixed with other audio and video streams in the room into one stream, achieving the desired effect while reducing the complexity of the client and recording playback.
Cloud-Based Mixed-Stream Transcoding Golang Version Code Example:
// Specify output parameters to determine the destination of the mixed video stream. If bypass streaming and cloud recording are set to global automation, this parameter can be ignored.
request.OutputParams = &trtc.OutputParams{
// Specify StreamId in OutputParams to indicate that this mixed video stream requires bypass streaming. The string here can be defined as needed.
// Specify mixed-stream audio and video encoding parameters, and adjust as needed
request.EncodeParams = &trtc.EncodeParams{
AudioSampleRate: common.Uint64Ptr(48000),
AudioChannels: common.Uint64Ptr(1),
AudioBitrate: common.Uint64Ptr(50),
VideoWidth: common.Uint64Ptr(1280),
VideoHeight: common.Uint64Ptr(720),
VideoBitrate: common.Uint64Ptr(500),
VideoFramerate: common.Uint64Ptr(20),
VideoGop: common.Uint64Ptr(3),
}
// Specify the mixed-stream layout, here we choose the predefined layout template 2 (screen sharing template), and set the large screen to display the whiteboard streaming video.
// Here we assume the user's whiteboard streaming ID is "tic_push_user_880528_test", please replace it with the actual whiteboard streaming user ID when in use
The whiteboard streaming service is responsible for pushing the whiteboard content to the specified audio and video room as the main stream. There are usually two ways for the viewer to watch this stream:
Real-time Watching by Joining the Room: The viewer integrates the TRTC SDK, joins the same audio and video room, and subscribes to the corresponding stream through the SDK API. For specific implementation, refer to the relevant guide document Importing the SDK.
Watching via CDN-based Relayed Live Streaming: Enable bypass streaming and watch by pulling the stream through the live CDN. For specific implementation, refer to the relevant guide document CDN Live Watching.