5.1.0 • Published 1 year ago

@project-sunbird/content-player v5.1.0

Weekly downloads
104
License
MIT
Repository
-
Last release
1 year ago

npm.io npm version

Content Player

Content-Player which is used to play/render the contents in both device and web.

Supported Content MIME Types

Content TypeMIME Type
ECMLapplication/vnd.ekstep.ecml-archive
HTMLapplication/vnd.ekstep.html-archive
Epubapplication/epub
H5Papplication/vnd.ekstep.h5p-archive
PDFapplication/pdf
YOUTUBEvideo/x-youtube
WEBMvideo/Webm
MP4video/mp4
EXTERNAL CONTENTtext/x-url

How to render the contents?

Content player is a customisable and configurable before launching any type of content inside any environment (preview or device) it expecting few configurations. Based on the configuration content will be rendered in the respective environment.

Download content player preview from NPM

npm i @project-sunbird/content-player

Preview object

var previewObj = {
    "context": {
        "mode": "preview/edit/play", // to identify preview used by the user to play/edit/preview
        "authToken": "", // Auth key to make V3 api calls
        "contentId": "do_201734893", // ContentId used to get body data from content API call
        "sid": "sdjfo8e-3ndofd3-3nhfo334", // User sessionid on portal or mobile
        "did": "sdjfo8e-3ndofd3-3nhfo334", // Unique id to identify the device or browser 
        "uid": "sdjfo8e-3ndofd3-3nhfo334", // Current logged in user id
        "channel": "", // To identify the channel(Channel ID). Default value ""
        "pdata": // Producer information. Generally the App which is creating the event, default value {}
        {
            "id": "", // Producer ID. For ex: For sunbird it would be "portal" or "genie"
            "pid": "", // Optional. In case the component is distributed, then which instance of that component
            "ver": "", // version of the App
        },
        "app": [""], // Genie tags
        "partner": [""], // Partner tags
        "dims": [""], // Encrypted dimension tags passed by respective channels
        "cdata": [{ //correlation data
            "type": "", //Used to indicate action that is being correlated
            "id": "" //The correlation ID value
        }],

    },
    "config": {
        "repos": ["s3path"], // plugins repo path where all the plugins are pushed s3 or absolute folder path
        "plugins": [{ id: "org.sunbird.telemtryPlugin", "ver": "1.0", "type": "plugin" }], //Inject external custom plugins into content (for externl telemetry sync)
        "overlay": { // Configuarable propeties of overlay showing by GenieCanvas on top of the content
            "enableUserSwitcher": true, // enable/disable user-switcher, default is true for mobile & preview
            "showUser": true, // show/hide user-switcher functionality. default is true to show user information
            "showOverlay": true, // show/hide complete overlay including next/previous buttons. default value true
            "showNext": true, // show/hide next navigation button on content. default is true
            "showPrevious": true, // show/hide previous navigation button on content. default is true
            "showSubmit": false, // show/hide submit button for assessmetns in the content. default is false
            "showReload": true, // show/hide stage reload button to reset/re-render the stage. default is true
            "menu": {
                "showTeachersInstruction": true // show/hide teacher instructions in the menu
            }
        },
        "splash": { // list of configurable properties to handle splash screen shown while loading content
            "text": "Powered by Sunbird", // Text to be shown on splash screen while loading content. 
            "icon": "assets/icons/icn_genie.png", // Icon to be show on above the text(full absolute path of the image in mobiew or http image link)
            "bgImage": "assets/icons/background_1.png", // backgroung image used for splash screen while loading content(absolute folder path of the image in mobie or http image link)
            "webLink": "XXXX" // weblink to be opened on click of text
        },
        "mimetypes": [ // Content mimetypes for new cotent lucnhers
            "application/vnd.ekstep.ecml-archive",
            "application/vnd.ekstep.html-archive"
        ],
        "contentLaunchers": [ // content laucher plugins for specific content mimetypes
            { // Plugin used for ECML content to launch, It is default plugin
                "mimeType": 'application/vnd.ekstep.html-archive',
                "id": 'org.sunbird.htmlrenderer',
                "ver": 1.0,
                "type": 'plugin'
            }
        ]
    },
    "metadata": {}, //content metadata json object (from API response take -> response.result.content)
    "data": undefined // content body json object (from API response take -> response.result.content.body)
}

Description

Property NameDescriptionDefault Value
hostIt is a string which defines the from which domain content should be loadwindow.location.origin
mimetypesIt is an array which defines the what type of the content to be renderer[ ]
contentLaunchersIt is an array of plugin objects it will launch the content based on the mimeType which is defined[]
overlayIt is an object using this canvas overlay can be customized based on the flags{}
splashIt is an object before launching any type of content splash screen will load and it is customizable{}
showEndpageIt is boolean which defines should default canvas endpage should load or notTRUE
pdataIt is an object which defines the producer information it should have identifier and version and canvas will log in the telemetry{'id':'in.ekstep', 'ver':'1.0'}
channelIt is string which defines channel identifier to know which channel is currently using.in.ekstep
appIt is an array which defines the app tags and canvas will log in the telemetry[]
partnerIt is an array which defines the partner tags and canvas will log in the telemetry[]
dimsIt is an array which defines the encrypted dimension tags it should be passed from the respective channel and canvas will log in the telemetry[]
contextIt is an object it contains the uid,did,sid,mode etc., these will be logged inside the telemetry{}
configIt is an object it contains the repo,plugins,overlay,splash etc., these will be used to configure the canvas{}
apislugIt is string which defines proxy setup to make a api request/action
  1. How to render in Web

    Content player will render inside the web environment with the above configuration .

    	**HTML**
    	```html
    	<div class="content-player">
    	    <iframe id="preview" src ='./node_modules/@project-sunbird/content-player/preview.html?webview=true' width=100% height=100%></iframe>
  2. How to render in Device(cordova)

Content player will render inside Cordova environment and it's accepting the configuration through cordova webintent

How to setup content player in local

Prerequisites

  • Install NPM, Node(v6), android-sdk, Cordova and Ionic

    How to Run

  • Clone the content player from here

  • Run npm install in PROJECT_FOLDER/player path
  • Disable isCorePluginsPackaged variable in the appConfig.js to load/run the plugins without minifiying.
  • To run player in local run node app in the Terminal
  • Open http://localhost:3000/ in the browser. By default player runs in the 3000 port

    How to build

    1. Preview

      	Run `npm run build-preview sunbird` which creates the preview folder for sunbird instance
    2. AAR

      	Run  `npm run build-aar sunbird`  which creates an aar file for the sunbird instance

      The AAR file will create in the below path.

      PROJECT_FOLDER/player/platforms/android/build/outputs/aar/geniecanvas-BUILD_NUMBER-debug.aar

    3. Plugins Package

      Run npm run package-coreplugins -- --env.channel sunbird Which bundles all the coreplugins plugins and creates the coreplugins.js and coreplugins.css

    4. Test Cases

      Run npm run test Which runs the player test cases.

Change Logs

See ChangeLogs for more information

License

This project is licensed under the MIT License - see the LICENSE file for details

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Any Issues ?

We have an open and active issue tracker. Please report any issues.

5.1.0

1 year ago

4.4.0

2 years ago

3.7.5

3 years ago

3.7.4

3 years ago

3.7.3

3 years ago

3.7.2

3 years ago

3.7.1

3 years ago

3.7.0

3 years ago

3.6.4

3 years ago

3.6.3

3 years ago

3.7.1-0

3 years ago

3.6.2

3 years ago

3.6.1

3 years ago

3.6.1-0

3 years ago

3.5.1-0

3 years ago

3.5.1

3 years ago

3.5.0

3 years ago

3.4.1

3 years ago

3.3.7

3 years ago

3.3.6

3 years ago

3.4.0

3 years ago

3.3.5

3 years ago

3.3.4

3 years ago

3.3.1

4 years ago

3.3.0

4 years ago

3.3.3

4 years ago

3.3.2

4 years ago

3.2.6

4 years ago

3.2.5

4 years ago

2.9.3

4 years ago

3.2.4

4 years ago

3.2.3

4 years ago

3.2.2

4 years ago

3.2.2-0

4 years ago

3.2.1

4 years ago

3.2.0

4 years ago

3.1.3

4 years ago

3.1.2

4 years ago

3.1.1

4 years ago

3.1.0

4 years ago

3.0.0

4 years ago

2.10.2

4 years ago

3.0.0-0

4 years ago

2.10.0

4 years ago

2.9.2

4 years ago

2.9.1

4 years ago

2.8.4

4 years ago

2.8.3

4 years ago

2.7.1-alpha-1.0

4 years ago

2.6.0

4 years ago

2.6.0-beta.0

4 years ago

1.1.0

5 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago