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.
- KN-63Getting issue details... STATUS
PDF player configuration
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.
pdfPlayerConfig = { context?: Context; config?: Config; metadata: 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. |
|
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 |
|
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 | { | {} | 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 | Optional | 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 | { |
pdata: If we not pass the pdata the pdata will not logged in telemetry
Sample telemetry data without pdata
{"eid":"INTERACT","ets":1662988243357,"ver":"3.0","mid":"INTERACT:fcd57afb91574c6526058b5aa68403de","actor":{"id":"3c0a3724311fe944dec5df559cc4e006","type":"User"},"context":{"channel":"505c7c48ac6dc1edc9b08f21db5a571d","env":"contentplayer","sid":"7283cf2e-d215-9944-b0c5-269489c6fa56","did":"3c0a3724311fe944dec5df559cc4e006","cdata":[{"id":"XBfyG8Hd4lF7SKSM9Rvj5CdoXKfntwEd","type":"ContentSession"},{"id":"bFLHgkI1NTnhl1IOzS2nch0bH3EkpFkE","type":"PlaySession"},{"id":"2.0","type":"PlayerVersion"}],"rollup":{"l1":"505c7c48ac6dc1edc9b08f21db5a571d"},"uid":"anonymous"},"object":{"id":"do_31291455031832576019477","ver":"undefined","type":"Content","rollup":{}},"tags":[""],"edata":{"type":"TOUCH","subtype":"","id":"next","pageid":"2"}}
contextRollup: If we not pass the pdata the pdata will not logged in telemetry
Sample content object telemetry data without rollup
"context": { .... .... "rollup": {}, "uid": "anonymous" }
sid, did, uid, channel: If we not pass the pdata the pdata will not logged in telemetry
Sample telemetry data without pdata:
{"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:
"context": { ... "tags": [],
objectRollup: If we not pass the pdata the pdata will not logged in telemetry
Sample content object telemetry data without rollup
"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.
dispatcher: Dispatcher is required to receive the player events. This is optional and if we not passed, the parent will not received the player events.
dispatcher: { dispatch(event) { console.log(`Events from dispatcher: ${JSON.stringify(event)}`); } }
Sample context object interface:
{ 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; }; }
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 | optional | true |
download | It is | optional | true |
It is | optional | true | |
reply | It is | optional | false |
exit | It is | optional | false |
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 data
"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 | Required | Its a unique content id so Its a required to log the telemetry and other data against contnet |
Name | It is | Required | Its a required to show the name of the pdf while loading the pdf. |
streamingUrl | It is | 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 | 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 | Required | Its a required to show the name of the pdf while loading the pdf. |
isAvailableLocally | It is a | Required | It is required to know - the content is downloaded and can be play offline |
artifactUrl | It is a | Required | It is required to load the pdf file. |
basePath | It is | Required but optional if baseDir is present | It is required to load the pdf file. |
baseDir | It is | Required but optional if basePath is present | It is required to load the pdf file. |