Polyv Help Center

Help Center

Announcement

Updated: 2024-04-22 19:18:32

Feature Overview

This module is used to handle announcement operations from users such as instructors, teaching assistants, and administrators.

Initialization and Destruction

Before instantiating and using this module, you need to initialize and configure the SDK. For details, see the reference documentation.

Online File Import Method

// script 标签引入,根据版本号引入JS版本。
<script src="https://websdk.videocc.net/interactions-receive-sdk/0.24.0/lib/polyv-ir.umd.js"></script>

<script>
    const { Announcement } = window.PolyvIRSDK;
</script>
import { Announcement } from '@polyv/interactions-receive-sdk';

const announcementSdk = new Announcement();
// 销毁 SDK 实例,清除逻辑
announcementSdk.destroy();

Usage Flow

Listen for the "Announcement Received" Event

After an announcement is sent by an initiator such as an instructor or teaching assistant, the announcementSdk.events.BULLETIN event is triggered. The event parameters include the announcement ID and content. The integrator can listen for this event and display the content accordingly.

announcementSdk.on(announcementSdk.events.BULLETIN, function(msg) {
  console.log(`收到公告,公告ID:` + msg.id + `,公告内容:` + msg.content);
});

Listen for the "Announcement Closed" Event

After the initiator closes the announcement, the announcementSdk.events.REMOVE_BULLETIN event is triggered. The integrator can then remove the announcement display accordingly.

announcementSdk.on(announcementSdk.events.REMOVE_BULLETIN, function(msg) {
  console.log('公告已关闭:' + msg.id);
});

Note

If the announcement SDK is no longer needed, please call the destroy method of the SDK instance to destroy it.

联系客服,在线咨询