Introduction
Currently, to play the contents we need to pass all the config data to the player. In this config there are some mandatory and options fields. This wiki explains those mandatory and optional fields.
...
The following configuration is required to play the pdf content in player
context(Optional) : Additional data to the content
config (Optional) : Config object data to content play
metadata (Required) : Metadata gives a complete information about the content.
Code Block |
---|
pdfPlayerConfig = { context?: {_contextData_}, Context; config?: {_configData_}, Config; metadata: { _metadataObject_ // Some of the metadata fields are required. Mentioned in below 3.Metadata section } } |
1.
...
Context (Optional):
Context is an optional property for player config, if we want to send the context - the following table shows what are the fields is required to send the context.
Sample context object interface:
Code Block |
---|
{
mode?: string;
authToken?: string;
sid?: string;
did?: string;
uid?: string;
channel: string;
pdata: Pdata;
contextRollup?: ContextRollup;
tags?: string[];
cdata?: Cdata[];
timeDiff?: number;
objectRollup?: ObjectRollup;
host?: string;
endpoint?: string;
dispatcher?: object;
userData?: {
firstName?: string;
lastName?: string;
};
} |
Property name | Description |
---|
Optional/Required |
---|
Without |
---|
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.
sid
User sessionId
Required
sid will log in telemetry
field | Comment | Default | Code changes required |
---|---|---|---|
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.
| it is an | Required
| telemetry validation error | Default can be set from player side. Telemetry sdk will set by default |
| Yes | |||
2 |
| It is an | Required | telemetry validation error | Content player set it by default to |
| No | ||
3 |
| Producer data. It is an | Required
| telemetry validation error | Default can be set from player side. Telemetry sdk will set by default |
| Yes | ||
4 |
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
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.
pdata
producer id
Required
{
"id": "sunbird.portal",
"ver": "3.2.12",
"pid": "sunbird-portal.contentplayer"
}
{}
Default can be set from player side
|
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
To identify preview used by the user to play/edit/preview | Optional |
| Telemetry sdk will set by default as |
| No | ||
5 |
| It is an | Optional |
| Telemetry sdk will set by default as |
| No |
6 |
| It is an | Optional | It will generate from telemetry sdk | Telemetry sdk will set by default using fingerPrintJs | No | |
7 |
| It is an | Optional |
| Telemetry sdk will use |
| No |
8 |
| It is an | Optional |
| Player will set default |
| Yes |
9 |
| Defines the content rollup data | Optional |
Context rollup will log in telemetry context
| Its a optional field in telemetry |
| No |
10 |
| Defines the content object data | Optional |
Object rollup will log in telemetry
| Its a optional field in telemetry |
tags
defines the tags data
Optional
Tag will log
| No | ||||||
11 |
| It is an | Optional |
| Its a optional tags data |
| No |
timeDiff
It defines the time difference
Optional
No change in telemetry data
No change in telemetry data
This can be a optional field
host
Defines the from which domain content should be loaded
Optional
No change in telemetry data
No change in telemetry data
12 |
|
Defines the correlation data
Required
Must required in telemtry
Telemetry validation will fail
Correlation data requires for telemetry
It is an | Optional
|
| This is an optional but - if we are passing the |
| No | ||
13 |
| It is an | Optional |
| Content Player set it as | “ | No |
14 |
| It defines the endpoint | Optional |
No change in telemetry data
No change in telemetry data
This can be a optional
| Content Player set it as “ |
| No | |
15 |
| Defines the user first name and last name | Optional |
User first and lastname will not show in endpage | Default can be set from player side |
pdata: If we not pass the pdata the pdata will not logged in telemetry
Sample telemetry data without pdata
...
. |
...
contextRollup: If we not pass the pdata the pdata will not logged in telemetry
...
|
...
|
...
|
...
|
...
|
...
sid, did, uid, channel: If we not pass the pdata the pdata will not logged in telemetry
Sample telemetry data without pdata:
Code Block |
---|
{"eid":"INTERACT","ets":1662989700604,"ver":"3.0","mid":"INTERACT:df20f452603133275899885c89826a0a","actor":{"id":"ac7fa5a7da1312d0603d351c941a2813","type":"User"},"context":{"pdata":{"id":"sunbird.portal","ver":"3.2.12","pid":"sunbird-portal.contentplayer"},"env":"contentplayer","did":"ac7fa5a7da1312d0603d351c941a2813","cdata":[{"id":"QtPz7hI6rQjEqosRF3Shlwx9jhMOSzGs","type":"ContentSession"},{"id":"ikwUrq2L04DcojCek0Remi2nvmlbkJwr","type":"PlaySession"},{"id":"2.0","type":"PlayerVersion"}],"rollup":{"l1":"505c7c48ac6dc1edc9b08f21db5a571d"}},"object":{"id":"do_31291455031832576019477","ver":"undefined","type":"Content","rollup":{}},"tags":[""],"edata":{"type":"TOUCH","subtype":"","id":"next","pageid":"2"}} |
tags: If we not pass the tags the empty tags will log in telemetry
Sample telemetry data without tags:
Code Block |
---|
"context": {
...
"tags": [], |
objectRollup: If we not pass the pdata the pdata will not logged in telemetry
Sample content object telemetry data without rollup
Code Block |
---|
"context: {
},
"object": {
"id": "do_31291455031832576019477",
"ver": "undefined",
"type": "Content",
"rollup": {}
}, |
userData: If we pass the userData, it will show in endpage.
...
If we not send - it will not show.
...
| Yes | |
16 |
| Dispatcher is required to receive the player events |
...
. . | Optional | The parent will not |
...
see the player events. |
|
...
Sample context object:
...
...
|
...
| No |
...
2. Config (Optional)
All the configuration can be set by default from player side so this config object can be optional
sideMenu
: If we not pass the side menu object for pdf config - the default the following menu will show in sidemenu
Share
Download
Print
...
sample config object interface:
Code Block |
---|
"config"?: { "sideMenu"?: { "showShare"?: true,boolen; // show/hide share button in side menu. default value is true "showDownload"?: true,boolen; // show/hide download button in side menu. default value is true "showReplay"?: true,boolen; // show/hide replay button in side menu. default value is true "showExit"?: false,boolen; // show/hide exit button in side menu. default value is false "showPrint"?: trueboolen; // show/hide print button in side menu. default value is true } } |
Property name | Description | Optional/Required | Default |
---|---|---|---|
| It is | optional |
|
| It is | optional |
|
| It is | optional |
|
| It is | optional |
|
| It is | optional |
|
...
3. Metadata (Required)
Metadata gives a complete information about the content.
Based on the isAvailableLocally
property player will be playing the content online or offline.
Sample metadata object interface:
Code Block |
---|
"metadata": {
"identifier": string;
"name": string;
"artifactUrl": string;
"streamingUrl"?: string;
} |
In metadata the following properties are mandatory to play the content in ONLINE play.
Property name | Description | Without field | optional/Required | Comment |
---|---|---|---|---|
| It is | Unable to load the content error | Required | Its a unique content id so Its a required to log the telemetry and other data against contnet |
| It is | Unable to load the content error | Required | Its a required to show the name of the pdf while loading the pdf. |
| It is | Unable to load the content error | Required but optional if the artifactUrl is present | It is optional field. This is required if you want to load the streaming pdf url |
| It is a | Unable to load the content error | Required but optional if streamingUrl is preset | It is required to load the pdf file. |
Sample metadata object interface in offline play:
Code Block |
---|
"metadata": { "identifier": string; "name": string; "artifactUrl": string; "basePath": string; // should requird to play offline "baseDir?": string; "streamingUrl |
...
"?: string;
} |
Following properties are mandatory to play the content OFFLINE play.
Property name | Description | Without field | Optional/Required | Comment |
---|---|---|---|---|
| It is | Unable to load the content error | Required | Its a required to show the name of the pdf while loading the pdf. |
| It is a | Content will not load offline | Required | It is required to know - the content is downloaded and can be play offline |
| It is a | Unable to load the content error | Required | It is required to load the pdf file. |
| It is | Unable to load the content error | Required but optional if | It is required to load the pdf file. |
| It is | Unable to load the content error | Required but optional if | It is required to load the pdf file. |