Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The following configuration is required to play the pdf content in player

  1. context(Optional) : Additional data to the content

  2. config (Optional) : Config object data to content play

  3. metadata (Required) : Metadata gives a complete information about the content.

Code Block
pdfPlayerConfig = {
    context?: {_contextData_}, Context;
    config?: {_configData_}, Config;
    metadata: {_metadataObject_}any; // content data
}

1. Context contains the following properties:

Property name

Description

optional/Required

With property

Without property

Comment

Default

1

mode

To identify preview used by the user to play/edit/preview

Optional

No change in telemetry data

No change in telemetry data

Can be set it as preview from the player side. There is no major impact in player preview.

"preview"

2

authToken

Auth key to make the api call

Optional

No change in telemetry data

No change in telemetry data

As we are not calling any api from player side authtoken property can be optional.

“ “

3

sid

User sessionId

Required

sid will log in telemetry

sid will not log in telemetry

Default can be set from player side

“ ”

4

did

Unique id to identify the device

Required

did will log in telemetry

did will not log in telemetry

Default can be set from player side

“ “

5

uid

Current logged in user id

Required

uid will log in telemetry

uid will not log in telemetry

Default can be set from player side

"anoymous"

6

channel

Unique id of the channel

Required

channel id will log in telemetry

channel id will not log in telemetry

This can be a optional and can be set it from player side a a default parameter.

“ “

7

pdata

producer id

Required

{
"id": "sunbird.portal",
"ver": "3.2.12",
"pid": "sunbird-portal.contentplayer"
}

{}

Default can be set from player side

{}

8

contextRollup

Defines the content rollup data

Optional

Context rollup will log in telemetry context

content rollup will not log in context

Its a optional field in telemetry

{}

9

objectRollup

Defines the content object data

Optional

Object rollup will log in telemetry

Object rollup will not log in telemetry

Its a optional field in telemetry

{}

10

tags

defines the tags data

Optional

Tag will log

Empty tag list will log

Its a optional tags data

{}

11

cdata

Defines the correlation data

Required

Must required in telemtry

Telemetry validation will failOptional

Cdata will log

cdta will log in telemetry

Correlation data requires for telemetry

{}

12

timeDiff

It defines the time difference

Optional

No change in telemetry data

No change in telemetry data

This can be a optional field

“ “

13

host

Defines the from which domain content should be loaded

Optional

No change in telemetry data

No change in telemetry data

Default can be set from player side

“ “

14

endpoint

It defines the endpoint

Optional

No change in telemetry data

No change in telemetry data

This can be a optional

“ “

15

userData

Defines the user first name and last name

Optional

End page will show the first name and last name from userData

User first and lastname will not show in endpage

Default can be set from player side

{
"firstName": "anoymous",
"lastName": ""
}

  • pdata: If we not pass the pdata the pdata will not logged in telemetry

...

Code Block
dispatcher: {
        dispatch(event) {
          console.log(`Events from dispatcher: ${JSON.stringify(event)}`);
        }
      }

Sample context object interface:

Code Block
{
      "mode"?: "play",  // To identify preview used by the user to play/edit/preview
    "authToken": "", // Auth key to make  api calls
    "sid": "7283cf2e-d215-9944-b0c5-269489c6fa56", // User sessionid on portal or mobile 
    "did": "3c0a3724311fe944dec5df559cc4e006", // Unique id to identify the device or browser 
    "uid": "anonymous", // Current logged in user id
    "channel": "505c7c48ac6dc1edc9b08f21db5a571d", // Unique id of the channel(Channel ID)
    "pdata": {
string;
      authToken?: string;
      sid: string;
      did: string;
      uid: string;
      channel: string;
      pdata: Pdata;
     "id": "sunbird.portal", // Producer ID. For ex: For sunbird it would be "portal" or "genie"
      "ver": "3.2.12", // Version of the App
      "pid": "sunbird-portal.contentplayer" // Optional. In case the component is distributed, then which instance of that component
    },
    "contextRollup": { // Defines the content roll up data
      "l1": "505c7c48ac6dc1edc9b08f21db5a571d"
    },contextRollup?: ContextRollup;
      "tags"?: [ // Defines the tags data
      ""
    ],string[];
      "cdata": Cdata[],;
// Defines correlation data     "timeDiff"?: 0,  // Defines the time differencenumber;
      "objectRollup"?: {}, // Defines the object roll up data
    "host": "", // Defines the from which domain content should be loadObjectRollup;
      host?: string;
      endpoint?: string;
      "endpoint": "", // Defines the end pointdispatcher?: object;
      "userData"?: {
 // Defines the user data firstname & lastname   firstName: string;
  "firstName": "",       "lastName": ""string;
    }  };
}

...

2. Config

All the configuration can be set by default from player side so this config object can be optional

Property name

Description

optional/Required

Default

share

It is boolen value to show and hide share button in sidemenu

optional

true

download

It is boolen value to show and hide download button in sidemenu

optional

true

print

It is boolen value to show and hide print button in sidemenu

optional

true

reply

It is boolen value to show and hide reply button in sidemenu

optional

false

exit

It is boolen value to show and hide exit button in sidemenu

optional

false

sideMenu: If we not pass the side menu object for pdf config - the default the following menu will show in sidemenu

...

sample config data

Code Block
"config"?: { 
    "sideMenu"?: { 
      "showShare"?: true, // show/hide share button in side menu. default value is true
      "showDownload"?: true, // show/hide download button in side menu. default value is true
      "showReplay"?: true, // show/hide replay button in side menu. default value is true
      "showExit"?: false, // show/hide exit button in side menu. default value is false
      "showPrint"?: true // show/hide print button in side menu. default value is true
    }
  }

...

3. Metadata

Metadata gives a complete information about the content. In metadata the following properties are mandatory to play the content online.

Property name

Description

optional/Required

Comment

identifier

It is string of uniq content id

Required

Its a unique content id so Its a required to log the telemetry and other data against contnet

Name

It is string to represent the name of the content or pdf

Required

Its a required to show the name of the pdf while loading the pdf.

streamingUrl

It is string url.

Required but optional if the artifactUrl is present

It is optional field. This is required if you want to load the streaming pdf url

artifactUrl

It is a string url

Required but optional if streamingUrl is preset

It is required to load the pdf file.

  • artifactUrl/streamingUrl : If we not pass the artifactUrl or streamingUrl, The pdf content will not load and it will show error. To load the content artifactUrl or streamingUrl is required.

...

Following properties are mandatory to play the content Offline.

Property name

Description

Optional/Required

Comment

Name

It is string to represent the name of the content or pdf

Required

Its a required to show the name of the pdf while loading the pdf.

isAvailableLocally

It is a boolen value which indicate the content is locally available

Required

It is required to know - the content is downloaded and can be play offline

artifactUrl

It is a string url

Required

It is required to load the pdf file.

basePath

It is string to represent the base path of the pdf file

Required but optional if baseDir is present

It is required to load the pdf file.

baseDir

It is string to represent the base path of the pdf file

Required but optional if basePath is present

It is required to load the pdf file.