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.

Courseware Preloading

Last updated: 2024-12-20 11:21:49

Overview

This article mainly introduces how to use the whiteboard courseware preloading feature.

Platform and Version Support

Execution Platform Type
Android
Windows
iOS
Mac OS
Web
Execution Platform Version
11.4+
11.0+
TEduBoardSDK Version
2.6.9.145+
2.6.9.240+
2.6.9.92+
2.6.9.92+
TIWCache Version
1.0.0.78+
1.0.0.72+
1.0.0.72+
Note:
For unsupported system versions, system platform, and Interactive Whiteboard versions, courseware loading will be performed from the public network.

How It Works





How to Use

1. File transcoding application in the compressed package

When initiating courseware transcoding , set CompressFileType to zip. In the transcoding result , the CompressFileUrl field will generate a zip package URL.
Initiate transcoding example (Python):
req = models.CreateTranscodeRequest()
params = {
"SdkAppId": 1400127140,
"CompressFileType": "zip" // Apply for transcoding and create a zip package for the transcoding result
... // Other parameters
}
req.from_json_string(json.dumps(params))

resp = client.CreateTranscode(req)


2. Get courseware transcoding results

Courseware transcoding results can be obtained through Active Query or Callback method.
Results example:
{
"Response": {
"TaskId": "0poq8tn4ts23317ta77c",
"ResultUrl": "https://whiteboard-cam-test-1257307760.cos.ap-nanjing.myqcloud.com/doc/0poq8tn4ts23317ta77c_tiw/h5/index.html",
"CompressFileUrl": "https://whiteboard-cam-test-1257307760.cos.ap-nanjing.myqcloud.com/doc/0poq8tn4ts23317ta77c_tiw/0poq8tn4ts23317ta77c.zip"
... // Other results parameters
}
}

3. Local preloading of courseware

3.1 Pre-class use

Before the class, since there is no Interactive Whiteboard object yet, the Interactive Whiteboard SDK provides the TEduBoardResourceController class to support courseware preloading.
Android
// Set sdkAppId and userId
TEduBoardResourceController.setConfig(sdkAppId, userId);
// Load the courseware zip package
TEduBoardResourceController.loadResource(context, "https://whiteboard-cam-test-1257307760.cos.ap-nanjing.myqcloud.com/doc/0poq8tn4ts23317ta77c_tiw/0poq8tn4ts23317ta77c.zip");
iOS / Mac
TEduBoardResourceConfig *config = [[TEduBoardResourceConfig alloc] init];
config.sdkAppId = self.sdkAppId;
config.userId = self.userId;
[TEduBoardResourceController setConfig:config];
[TEduBoardResourceController loadResource:@"https://whiteboard-cam-test-1257307760.cos.ap-nanjing.myqcloud.com/doc/0poq8tn4ts23317ta77c_tiw/0poq8tn4ts23317ta77c.zip"];
Windows
std::string strUserID = strUserID;
unsigned int sdkAppid = sdkAppid;
SetTeduBoardResourceConfig(sdkAppid, strUserID.c_str());
std::string strUrl = "https://whiteboard-cam-test-1257307760.cos.ap-nanjing.myqcloud.com/doc/0poq8tn4ts23317ta77c_tiw/0poq8tn4ts23317ta77c.zip";
LoadTeduBoardResource(strUrl.c_str());

3.2 In-class usage

Directly use the loadResource interface on the whiteboard objects for courseware preloading.
Android
// Load the courseware zip package
teduBoardController.loadResource("https://whiteboard-cam-test-1257307760.cos.ap-nanjing.myqcloud.com/doc/0poq8tn4ts23317ta77c_tiw/0poq8tn4ts23317ta77c.zip");
iOS / Mac
[self.boardController loadResource:@"https://whiteboard-cam-test-1257307760.cos.ap-nanjing.myqcloud.com/doc/0poq8tn4ts23317ta77c_tiw/0poq8tn4ts23317ta77c.zip"];
Windows
std::string strUrl = "https://whiteboard-cam-test-1257307760.cos.ap-nanjing.myqcloud.com/doc/0poq8tn4ts23317ta77c_tiw/0poq8tn4ts23317ta77c.zip";
LoadTeduBoardResource(strUrl.c_str());

3.3 Courseware preloading status callback

Android
TIWCacheManager.getInstance(Context).setListener(new TIWCacheListener() {
@Override
public void onTIWCacheCoursewareDownloaded(String zipUrl, int errcode, String message) {

}
});
iOS / Mac
[[TIWCacheManager shareInstance] setDelegate:delegate];
// override the callback method
- (void)onTIWCacheCoursewareDownloaded:(NSString *)zipUrl errorCode:(uint32_t)errcode message:(NSString *)message;

4. Add transcoding files to the interactive whiteboard

After completing the above 3 steps, you only need to call the addTranscodeFile interface to add the transcoded results to the whiteboard, then you can use the courseware loading capability from local.
// 1. For specific parameters, please refer to the results queried in step 2.
// 2. Please refer to the interface provided by each platform for the usage of the addTranscodeFile interface.
teduBoard.addTranscodeFile({
pages: Pages,
resolution: Resolution,
title: Title,
url: ResultUrl
})

Must-Knows

1. The bucket configuration for document transcoding on the interactive whiteboard transcoding console cannot directly use the default public bucket of the interactive whiteboard.



2. Courseware preloading only supports courseware in ZIP format, so when initiating transcoding, you need to set CompressFileType to ZIP.
3. The ZIP package courseware preloaded on the local device is only retained for 7 days. After 7 days, the interactive whiteboard will clear the ZIP package courseware from the local cache.
4. iOS/Android will only preload the same courseware once. For example, if courseware A corresponding to CompressFileUrl already exists in the local device cache, when using the same CompressFileUrl parameter to call loadResource to load courseware A again, it will be skipped directly.
5. Windows will overwrite the same courseware when preloading the same courseware. For example, if courseware B specified by the CompressFileUrl parameter already exists in the local device cache, when using the same CompressFileUrl parameter to call LoadTeduBoardResource to load courseware B again, it will overwrite the courseware B in the cache.