Skip to main content

You are viewing Agora Docs forBetaproducts and features. Switch to Docs

Android
iOS
Web
Electron

Upload course materials

In many online teaching scenarios, teachers use a variety of interactive courseware to deliver an informative learning experience. Flexible Classroom enables teachers to display such courseware during classes. The supported formats are PPT, PPTX, DOC, DOCX, PDF, MP3, MP4, PNG, JPG, and GIF.

Courseware in flexible classrooms can be divided into two categories:

  • Public resources: Uploaded and maintained by educational agencies; teachers cannot edit the courseware.
  • Personal resources: Uploaded and maintained by teachers on the client end.

To display courseware on the whiteboard in flexible classrooms, you must convert the courseware to a format supported by the Agora Interactive Whiteboard service. For security reasons, Flexible Classroom does not store your courseware; all courseware must be stored either in a third-party cloud storage account that you provide or on your own server.

Upload courseware before a class

If you want to upload the courseware to third-party cloud storage or to your own server before a class and then display the courseware in Flexible Classroom, perform the following steps:

  1. In Agora Console, enable and configure the Whiteboard feature to store the courseware used in Flexible Classroom.

  2. In Agora Console, enable the file-conversion feature of the Whiteboard service, and add a storage configuration for storing the converted courseware. For details, see How to enable the file-conversion feature.

  3. On your app server, call this RESTful API to start a file-conversion task. The Agora Interactive Whiteboard service uploads the converted files to the third-party cloud storage that you have configured in Agora Console.

  4. On your app server, poll this RESTful API to query the progress of a file-conversion task. According to the different types of converted resources, it can be divided into two types, static and dynamic, corresponding to static and dynamic resources, respectively. After a static resource is successfully converted, the structure needs to be converted first and then passed into the launch method.

    Query results returned by the whiteboard resource conversion service:


    _19
    {
    _19
    "uuid":"xxxxxxxxxxx",
    _19
    "type":"static",
    _19
    "status":"Finished",
    _19
    "convertedPercentage":100,
    _19
    "pageCount":2,
    _19
    "images":{
    _19
    "1":{
    _19
    "width":1700,
    _19
    "height":952,
    _19
    "url":"https://convertcdn.netless.link/staticConvert/xxx/1.png"
    _19
    },
    _19
    "2":{
    _19
    "width":1700,
    _19
    "height":952,
    _19
    "url":"https://convertcdn.netless.link/staticConvert/xxx/2.png"
    _19
    }
    _19
    }
    _19
    }

    converts to:


    _56
    courseWareList:
    _56
    [
    _56
    {
    _56
    // The file name displayed on the cloud disk
    _56
    resourceName: xxxxxxx,
    _56
    // A unique ID
    _56
    resourceUuid: xxxxxxxxx,
    _56
    // File name suffix
    _56
    ext: 'pdf',
    _56
    // The resources converted by the whiteboard can be left blank.
    _56
    url: '',
    _56
    // File size in bytes
    _56
    size: 0,
    _56
    // The last update time of the file, in milliseconds
    _56
    updateTime: xxxxxxxx,
    _56
    // Pass in the whiteboard resource conversion task ID here
    _56
    taskUuid: 'xxxxxxxxx',
    _56
    // Pass in the parameters you passed when you called the whiteboard API to initiate the whiteboard resource conversion task.
    _56
    conversion: {
    _56
    type: 'static',
    _56
    preview: true,
    _56
    scale: 2,
    _56
    outputFormat: 'png',
    _56
    },
    _56
    // Task conversion progress needs to bring in the following structural data
    _56
    taskProgress: {
    _56
    prefix: "", // The converted resource prefix, if any, is taken from the prefix in the whiteboard conversion result.
    _56
    // The total number of pages, take the pageCount field in the whiteboard conversion result
    _56
    totalPageSize: 2,
    _56
    // The total number of pages, take the pageCount field in the whiteboard conversion result
    _56
    convertedPageSize: 2,
    _56
    // Conversion progress, take the convertedPercentage field in the whiteboard conversion result
    _56
    convertedPercentage: 100,
    _56
    // Leave array empty
    _56
    convertedFileList: [],
    _56
    // Conversion progress, take the status field in the whiteboard conversion result
    _56
    currentStep: 'Finished',
    _56
    // Data structure required by static courseware
    _56
    images: [
    _56
    {
    _56
    // Key in images object
    _56
    name: '1',
    _56
    width: 1700,
    _56
    height: 952,
    _56
    url:"https://convertcdn.netless.link/staticConvert/xxx/1.png"
    _56
    },
    _56
    {
    _56
    name: '2',
    _56
    width: 1700,
    _56
    height: 952,
    _56
    url:"https://convertcdn.netless.link/staticConvert/xxx/2.png"
    _56
    },
    _56
    ]
    _56
    },
    _56
    }
    _56
    ]

    Dynamic resources do not require additional processing of images and can be passed in through the courseWareList method.

  5. When you call launch on your client, pass in the list of converted files by setting the courseWareList parameter. Then students can see the courseware in the classroom.


    _42
    courseWareList:
    _42
    [
    _42
    {
    _42
    // The file name displayed on the cloud disk
    _42
    resourceName: xxxxxxx,
    _42
    // A unique ID
    _42
    resourceUuid: xxxxxxxxx,
    _42
    // File name suffix
    _42
    ext: 'pptx',
    _42
    // The resources converted by the whiteboard can be left blank
    _42
    url: '',
    _42
    // File size in bytes
    _42
    size: 0,
    _42
    // The last update time of the file, in milliseconds
    _42
    updateTime: xxxxxxxx,
    _42
    // Pass in the whiteboard resource conversion task ID here
    _42
    taskUuid: 'xxxxxxxxx',
    _42
    // Here you need to pass in the parameters you passed when you called the whiteboard API to initiate the whiteboard resource conversion task.
    _42
    conversion: {
    _42
    type: 'dynamic',
    _42
    preview: true,
    _42
    scale: 2,
    _42
    outputFormat: 'png',
    _42
    },
    _42
    // Task conversion progress needs to bring in the following structural data
    _42
    taskProgress: {
    _42
    prefix: "", // The converted resource prefix, if any, is taken from the prefix in the whiteboard conversion result
    _42
    // The total number of pages, take the pageCount field in the whiteboard conversion result
    _42
    totalPageSize: 2,
    _42
    // The total number of pages, take the pageCount field in the whiteboard conversion result
    _42
    convertedPageSize: 2,
    _42
    // Conversion progress, take the convertedPercentage field in the whiteboard conversion result
    _42
    convertedPercentage: 100,
    _42
    // Leave array empty
    _42
    convertedFileList: [],
    _42
    // Conversion progress, take the status field in the whiteboard conversion result
    _42
    currentStep: 'Finished',
    _42
    // The data structure required for static courseware, and the empty array for dynamic courseware
    _42
    images: []
    _42
    },
    _42
    },
    _42
    ],

Upload courseware during a class

To upload courseware during a class, perform the following steps:

  1. Log in to Flexible Classroom, and enter the desired classroom.

  2. Click Cloud Drive in the tool bar, and then click Upload as shown in the following screenshot:

    You can delete your personal resources by selecting the option icon and clicking Delete, as shown in the following screenshot:

Cloud storage configuration

To ensure that Flexible Classroom can access your cloud storage, configure your cloud storage account as follows:

  • Alibaba Cloud OSS account

    • Ensure that read and write permissions are set to public read.

    • Cross domain rule configuration

      • Configure Source and Allow Headers according to your actual situation.
      • Exposure Headers must be filled in according to the figure below:

      alibaba-cloud-storage-config

  • AWS S3 accounts

    • Bucket policy


      _13
      {
      _13
      "Version": "2012-10-17",
      _13
      "Id": "Policy1622700880591",
      _13
      "Statement": [
      _13
      {
      _13
      "Sid": "Stmt1622700872941",
      _13
      "Effect": "Allow",
      _13
      "Principal": "*",
      _13
      "Action": "s3:GetObject",
      _13
      "Resource": "arn:aws-cn:s3:::agora-adc-artifacts/*"
      _13
      }
      _13
      ]
      _13
      }

    • Cross-origin resource sharing


      _15
      [
      _15
      {
      _15
      "AllowedHeaders": [
      _15
      "*"
      _15
      ],
      _15
      "AllowedMethods": [
      _15
      "PUT",
      _15
      "GET"
      _15
      ],
      _15
      "AllowedOrigins": [
      _15
      "*"
      _15
      ],
      _15
      "ExposeHeaders": []
      _15
      }
      _15
      ]

vundefined