Skip to content

Commit

Permalink
feat(FEC-8044): ima-dai plugin (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
yairans authored Apr 15, 2019
1 parent de4db03 commit ad005dc
Show file tree
Hide file tree
Showing 29 changed files with 4,941 additions and 689 deletions.
20 changes: 5 additions & 15 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
{
"parser": "babel-eslint",
"extends": [
"eslint:recommended",
"plugin:flowtype/recommended"
],
"plugins": [
"import",
"flowtype",
"mocha-no-only"
],
"extends": ["eslint:recommended", "plugin:flowtype/recommended"],
"plugins": ["prettier", "import", "flowtype", "mocha-no-only"],
"env": {
"browser": true,
"es6": true,
Expand All @@ -23,12 +16,9 @@
"__NAME__": true
},
"rules": {
"prettier/prettier": "error",
"mocha-no-only/mocha-no-only": "off",
"require-jsdoc": [
"error"
],
"valid-jsdoc": [
"error"
]
"require-jsdoc": ["error"],
"valid-jsdoc": ["error"]
}
}
5 changes: 2 additions & 3 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[ignore]
.*/node_modules/conventional-changelog-core/test/fixtures/_malformation.json
.*/node_modules/playkit-js/src/
.*/node_modules
[include]
[libs]
node_modules/playkit-js/flow-typed/
node_modules/@playkit-js/playkit-js/flow-typed/
[options]
unsafe.enable_getters_and_setters=true
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!-- If you are raising a bug playing a stream, you must fill out the following or your issue may not be responded to. For features or improvements, you may delete this. -->

##### Prerequisites

* [ ] Have you checked for duplicate [issues](https://github.com/kaltura/playkit-js-ima/issues): **\_\_**
* [ ] Which Plugin [version](https://github.com/kaltura/playkit-js-ima/releases) are you using: **\_\_**
* [ ] Can you reproduce the issue with our latest release version: **\_\_**
* [ ] Can you reproduce the issue with the latest code from master: **\_\_**
* [ ] What browser and OS names and versions are you using: **\_\_**
* [ ] If applicable, add test code or test page to reproduce:

```
Paste test code here
```

##### Expected behavior

What you expected to happen

##### Actual behavior

What actually happened

##### Console output

```
Paste the contents of the browser console here.
```
12 changes: 12 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
### Description of the Changes

Please add a detailed description of the change, whether it's an enhancement or a bugfix.
If the PR is related to an open issue please link to it.

### CheckLists

* [ ] changes have been done against master branch, and PR does not conflict
* [ ] new unit / functional tests have been added (whenever applicable)
* [ ] test are passing in local environment
* [ ] Travis tests are passing (or test results are not worse than on master branch :))
* [ ] Docs have been updated
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# MacOS
.DS_Store

# Logs
logs
*.log
Expand Down Expand Up @@ -32,10 +35,11 @@ jspm_packages

# Optional npm cache directory
.npm
.npmrc

# Optional REPL history
.node_repl_history

.idea/
.idea

/dist/
dist/
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/dist
/src/index.html
CHANGELOG.md
yarn.lock
yarn-error.log
LICENSE
12 changes: 12 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"printWidth": 150,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"jsxBracketSameLine": true,
"arrowParens": "avoid",
"proseWrap": "preserve"
}
77 changes: 66 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,79 @@
conditions: v1
sudo: required
dist: trusty
language: node_js
node_js:
- "node"

addons:
chrome: stable

cache:
yarn: true
directories:
- node_modules

before_install:
- export CHROME_BIN=/usr/bin/google-chrome
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- sudo apt-get update
- sudo apt-get install -y libappindicator1 fonts-liberation
- wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- sudo dpkg -i google-chrome*.deb
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- chmod +x ./scripts/travis.sh

script: ./scripts/travis.sh

stages:
- Tests
- Release canary
- Release

script:
- npm run eslint
- npm run flow
- npm run test
jobs:
fast_finish: true
include:
# https://docs.travis-ci.com/user/build-stages/deploy-github-releases/
- stage: Release
name: "Releasing a new version"
if: tag IS present
env: TRAVIS_MODE=release
deploy:
- provider: releases
api_key:
secure: $GH_TOKEN
file_glob: true
file: dist/*
prerelease: true
skip_cleanup: true
on:
branch: master
tags: true
- provider: npm
api_key: $NPM_TOKEN
email: $NPM_EMAIL
skip_cleanup: true
on:
tags: true
branch: master
# publish canary package if on master
- stage: Release canary
if: (branch = master) AND (type != pull_request) AND commit_message !~ /^chore\(release\)/
env: TRAVIS_MODE=releaseCanary
deploy:
provider: npm
api_key: $NPM_TOKEN
email: $NPM_EMAIL
skip_cleanup: true
tag: canary
on:
tags: false
branch: master
# Required tests
- stage: Tests
if: (branch = master) OR (tag IS present) OR (type = pull_request)
name: "Running lint"
env: TRAVIS_MODE=lint
- stage: Tests
if: (branch = master) OR (tag IS present) OR (type = pull_request)
name: "Running Flow type check"
env: TRAVIS_MODE=flow
- stage: Tests
if: (branch = master) OR (tag IS present) OR (type = pull_request)
name: "Running unit tests"
env: TRAVIS_MODE=unitTests
111 changes: 0 additions & 111 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,112 +1 @@
# PlayKit JS IMA DAI - IMA DAI plugin for the [PlayKit JS Player]

[![Build Status](https://travis-ci.org/kaltura/playkit-js-ima-dai.svg?branch=master)](https://travis-ci.org/kaltura/playkit-js-ima-dai)

PlayKit JS IMA DAI plugin integrates [IMA DAI SDK for HTML5] with the [PlayKit JS Player].

PlayKit JS IMA DAI is written in [ECMAScript6], statically analysed using [Flow] and transpiled in ECMAScript5 using [Babel].

[IMA DAI SDK for HTML5]: https://developers.google.com/interactive-media-ads/docs/sdks/html5/dai/
[Flow]: https://flow.org/
[ECMAScript6]: https://github.com/ericdouglas/ES6-Learning#articles--tutorials
[Babel]: https://babeljs.io

## Getting Started

### Prerequisites
The plugin requires [PlayKit JS Player] to be loaded first.

The plugin uses the [IMA DAI SDK for HTML5] Javascript SDK, if the SDK is already loaded on the page the plugin will use it, and if it's not then it will load it.

[Playkit JS Player]: https://github.com/kaltura/playkit-js

### Installing

First, clone and run [yarn] to install dependencies:

[yarn]: https://yarnpkg.com/lang/en/

```
git clone https://github.com/kaltura/playkit-js-ima-dai.git
cd playkit-js-ima
yarn install
```

### Building

Then, build the player

```javascript
yarn run build
```

### Embed the library in your test page

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

```html
<script type="text/javascript" src="/PATH/TO/FILE/playkit.js"></script> <!--PlayKit player-->
<script type="text/javascript" src="/PATH/TO/FILE/playkit-ima-dai.js"></script> <!--PlayKit IMA plugin-->
<div id="videoContainer" style="height:360px; width:640px">
<script type="text/javascript">
var config = {
...
plugins: {
imaDAI: {
imaDAI: {
assetKey: "sN_IYUG8STe1ZzhIIE_ksA",
cmsId : "19463",
videoId : "tears-of-steel",
apiKey:null,
isLive:true
}
}
}
...
};
var player = playkit.loadPlayer("videoContainer", config);
player.play();
</script>
```


## Running the tests

Tests can be run locally via [Karma], which will run on Chrome, Firefox and Safari

[Karma]: https://karma-runner.github.io/1.0/index.html
```
yarn run test
```

You can test individual browsers:
```
yarn run test:chrome
yarn run test:firefox
yarn run test:safari
```

### And coding style tests

We use ESLint [recommended set](http://eslint.org/docs/rules/) with some additions for enforcing [Flow] types and other rules.

See [ESLint config](.eslintrc.json) for full configuration.

We also use [.editorconfig](.editorconfig) to maintain consistent coding styles and settings, please make sure you comply with the styling.


## Compatibility

TBD

## Contributing

Please read [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c63ec426) for details on our code of conduct, and the process for submitting pull requests to us.

## Versioning

We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/kaltura/playkit-js-ima/tags).

## License

This project is licensed under the AGPL-3.0 License - see the [LICENSE.md](LICENSE.md) file for details
Loading

0 comments on commit ad005dc

Please sign in to comment.