Skip to content

Cloud TV and OVP Media Provider Plugins for the PlayChi JS Player

License

Notifications You must be signed in to change notification settings

TasvirChi/playchi-js-providers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PlayChi JS Providers - Cloud TV and OVP Media Provider Plugins for the PlayChi JS Player

Build Status code style: prettier

The PlayChi JS Providers plugin helps integrate Tasvirchi OVP and Cloud TV backend data APIs with the PlayChi JS Player.

PlayChi 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://github.com/tasvirchi/playchi-js-providers.git
cd playchi-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/playchi-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
      ts: "YOUR_TS", // 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 playchi.providers.ovp.Provider(options);
    // Step 3 - Create media info object
    var mediaInfo = {
      entryId: "YOUR_ENTRY_ID" // Mandatory
      ts: "YOUR_TS" // 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/playchi-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
      ts: "YOUR_TS", // 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 playchi.providers.ott.Provider(options);
    // Step 3 - Create media info object
    var mediaInfo = {
      entryId: "YOUR_ENTRY_ID", // Mandatory
      ts: "YOUR_TS", // 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

Tasvirchi 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

About

Cloud TV and OVP Media Provider Plugins for the PlayChi JS Player

Resources

License

Stars

Watchers

Forks

Packages

No packages published