pakhshkit-js-providers
v2.28.1
Published
[![Build Status](https://travis-ci.com/kontorol/pakhshkit-js-providers.svg?token=s2ZQw18ukx9Q6ePzDX3F&branch=master)](https://travis-ci.com/kontorol/pakhshkit-js-providers) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.s
Downloads
2
Readme
PakhshKit JS Providers - Cloud TV and OVP Media Provider Plugins for the PakhshKit JS Player
The PakhshKit JS Providers plugin helps integrate Kontorol OVP and Cloud TV backend data APIs with the PakhshKit JS Player.
PakhshKit JS Providers is written in ECMAScript6, analyzed statically using Flow, and transpiled in ECMAScript5 using Babel.
Table of Contents
Getting Started
Installing
First, clone and run yarn to install the required dependencies:
git clone https://gitlab.com/kontorol/pakhshkit-js-providers.git
cd pakhshkit-js-providers
yarn install
Building
Next, build the player:
yarn run build
Embed the Library In Your Test Page
Finally, add the bundle as a script tag in your page, and initialize the provider:
OVP Provider
<script type="text/javascript" src="/PATH/TO/FILE/pakhshkit-ovp-provider.js"></script>
<div id="player-placeholder" style="height:360px; width:640px">
<script type="text/javascript">
// Step 1 - Create a provider options object
var options = {
partnerId: "YOUR_PARTNER_ID", // Mandatory
ks: "YOUR_KS", // Optional
log:{
level: "LOG_LEVEL", // Optional
}
uiConfId: UI_CONF_ID, // Optional
env: { // Optional
serviceUrl: "YOUR_SERVICE_URL",
cdnUrl: "YOUR_CDN_URL"
}
};
// Step 2 - Create a provider instance
var provider = new pakhshkit.providers.ovp.Provider(options);
// Step 3 - Create media info object
var mediaInfo = {
entryId: "YOUR_ENTRY_ID" // Mandatory
ks: "YOUR_KS" // Optional
};
// Step 4 - Get the media config
provider.getMediaConfig(mediaInfo).then(function(mediaConfig) {
// Manipulate media config
});
</script>
</div>
Cloud TV Provider
<script type="text/javascript" src="/PATH/TO/FILE/pakhshkit-ott-provider.js"></script>
<div id="player-placeholder" style="height:360px; width:640px">
<script type="text/javascript">
// Step 1 - Create a provider options object
var options = {
partnerId: "YOUR_PARTNER_ID", // Mandatory
ks: "YOUR_KS", // Optional
log:{
level:"LOG_LEVEL", // Optional
}
uiConfId: UI_CONF_ID, // Optional
env: { // Optional
serviceUrl: "YOUR_SERVICE_URL",
cdnUrl: "YOUR_CDN_URL"
}
};
// Step 2 - Create a provider instance
var provider = new pakhshkit.providers.ott.Provider(options);
// Step 3 - Create media info object
var mediaInfo = {
entryId: "YOUR_ENTRY_ID", // Mandatory
ks: "YOUR_KS", // Optional,
mediaType: "YOUR_MEDIA_TYPE" // Optional, default: "MEDIA"
contextType: "YOUR_MEDIA_CONTEXT_TYPE", // Optional, default: "PLAYBACK"
protocol: "YOUR_PROTOCOL", // Optional
fileIds: "YOUR_FILE_IDS" // Optional
};
// Step 4 - Get the media config
provider.getMediaConfig(mediaInfo).then(function(mediaConfig) {
// Manipulate media config
});
</script>
</div>
Documentation
Running the Tests
You can run tests locally via Karma, which will run on Chrome, Firefox and Safari browsers.
yarn run test
You can also test individual browsers in the following way:
yarn run test:chrome
yarn run test:firefox
yarn run test:safari
Coding Style Tests
Kontorol uses ESLint recommended set with some additions for enforcing Flow types and other rules.
See ESLint config for the full configuration.
We also use .editorconfig to maintain consistent coding styles and settings; please make sure you comply with these styles.
Compatibility
TBD
Contributing
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests to us.
Versioning
We use SemVer for versioning. For the available versions, see the tags on this repository.
Licensing
This project is licensed under the AGPL-3.0 License - see the LICENSE.md file for details