Skip to content

Commit

Permalink
feat: ott provider (#40)
Browse files Browse the repository at this point in the history
BREAKING CHANGE PR - API has been changed.

Changes:

Change config API from getConfig() to getMediaConfig()
Add BaseProvider class which will reuse similar providers logic and properties. Each provider will need to override getMediaConfig() and _parseDataFromResponse() methods.
Change provider constructor API - now gets (ProviderOptions, playerVersion, logLevel (optional))
Add OTTProvider - implementation, samples & tests.
Create BaseProviderParserto reuse similar logic.
Split DataLoaderManager to OTT and OVP. Each data loader has its own multi request loader.
Add webpack entries to ott provider & bookmark service.
Changes that have been made  from the organizational aspect of the project:

split directories to ovp,ott,common (shared providers logic).
refactor from let to const where needed.
some code cleanups and improvements
add samples folder.
update tests
better typing
remove unnecessary enums
  • Loading branch information
Dan Ziv authored Jan 9, 2018
1 parent dcd66f0 commit 9d8adef
Show file tree
Hide file tree
Showing 109 changed files with 2,965 additions and 1,536 deletions.
67 changes: 59 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,67 @@ yarn run build

Finally, add the bundle as a script tag in your page, and initialize the provider

**OVP Provider**
```html
<script type="text/javascript" src="/PATH/TO/FILE/ovpProvider.js"></script>
<div id="videoContainer" style="height:360px; width:640px">
<script type="text/javascript" src="/PATH/TO/FILE/playkit-ovp-provider.js"></script>
<div id="player-placeholder" style="height:360px; width:640px">
<script type="text/javascript">
var partnerId = "YOUR_PARTNER_ID";
var entryId = "YOUR_ENTRY_ID";
var ovpProvider = new PlaykitJsProviders.OvpProvider(partnerId);
ovpProvider.getConfig(entryId).then(function(data) {
console.log(data);
// Manipulate data
// Step 1 - Create provider options object
var options = {
partnerId: "YOUR_PARTNER_ID", // Mandatory
ks: "YOUR_KS", // Optional
logLevel: "LOG_LEVEL", // Optional
uiConfId: UI_CONF_ID, // Optional
env: { // Optional
serviceUrl: "YOUR_SERVICE_URL",
cdnUrl: "YOUR_CDN_URL"
}
};
// Step 2 - Create provider instance
var provider = new playkit.providers.ovp.Provider(options);
// Step 3 - Create media info object
var mediaInfo = {
entryId: "YOUR_ENTRY_ID" // Mandatory
ks: "YOUR_KS", // Optional
};
// Step 4 - Get media config
provider.getMediaConfig(mediaInfo).then(function(mediaConfig) {
// Manipulate media config
});
</script>
```

**OTT Provider**

```html
<script type="text/javascript" src="/PATH/TO/FILE/playkit-ott-provider.js"></script>
<div id="player-placeholder" style="height:360px; width:640px">
<script type="text/javascript">
// Step 1 - Create provider options object
var options = {
partnerId: "YOUR_PARTNER_ID", // Mandatory
ks: "YOUR_KS", // Optional
logLevel: "LOG_LEVEL", // Optional
uiConfId: UI_CONF_ID, // Optional
env: { // Optional
serviceUrl: "YOUR_SERVICE_URL",
cdnUrl: "YOUR_CDN_URL"
}
};
// Step 2 - Create provider instance
var provider = new playkit.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 media config
provider.getMediaConfig(mediaInfo).then(function(mediaConfig) {
// Manipulate media config
});
</script>
```
Expand Down
2 changes: 0 additions & 2 deletions dist/ottProvider.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/ottProvider.js.map

This file was deleted.

Loading

0 comments on commit 9d8adef

Please sign in to comment.