Polyv Help Center

Help Center

Check-in

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

Overview

This module is primarily used to receive and process check-in operations initiated by users such as instructors, teaching assistants, and administrators.

Initialization and Destruction

Before instantiating and using this module, the SDK must be initialized and configured. 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 { CheckIn } = window.PolyvIRSDK;
</script>
import { CheckIn } from '@polyv/interactions-receive-sdk';

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

Usage Flow

Listening for the "Check-in Started" Event

When an initiator, such as an instructor or teaching assistant, initiates a check-in, the checkInSdk.events.SIGN_IN event is triggered. The event parameters include information such as the total check-in duration. The integrator can listen for this event and, based on this information, display a check-in countdown interface.

checkInSdk.on(checkInSdk.events.SIGN_IN, function(msg) {
  console.log(`开始签到,签到时长:`, msg.data.limitTime, `签到提示:`, msg.data.message);
});

Listening for the "Check-in Aborted" Event

If the initiator actively ends the check-in before the preset countdown finishes, the checkInSdk.events.STOP_SIGN_IN event is triggered. After this, viewers will no longer be able to submit check-in information. Therefore, upon receiving this event, the integrator should display a check-in termination prompt and no longer allow users to check in.

checkInSdk.on(checkInSdk.events.STOP_SIGN_IN, function(msg) {
  console.log('签到已终止');
});

Listening for the "Check-in Time Ended" Event

After the preset check-in time ends, the checkInSdk.events.SIGN_IN_FINISH event is triggered. Similar to the checkInSdk.events.STOP_SIGN_IN event, the integrator needs to display a prompt indicating that the check-in has ended.

checkInSdk.on(checkInSdk.events.SIGN_IN_FINISH, function(msg) {
  console.log('签到已结束');
});

Listening for the "Timer Update" Event

After the check-in starts, the SDK internally initiates a countdown processing logic. Whenever the remaining check-in time updates, the checkInSdk.events.SIGN_IN_TIME_UPDATED event is triggered (once per second after each update). In addition to handling the time from the "check-in started" event on their own, the integrator can also directly listen to this event for corresponding time processing and display.

checkInSdk.on(checkInSdk.events.SIGN_IN_TIME_UPDATED, function(msg) {
  console.log('剩余签到时间(毫秒):', msg.totalMsecs);
});

Performing a Check-in

After the check-in starts, use checkInSdk.toCheckIn() to perform a user check-in. Upon successful check-in, the corresponding event will be triggered.

Listening for the "Check-in Successful" Event

checkInSdk.on(checkInSdk.events.SIGN_IN_SUCCESS, function() {
  console.log('签到成功');
});

Note

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

联系客服,在线咨询