Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add flash engine #2

Merged
merged 12 commits into from
Aug 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"presets": [
"es2015"
],
"plugins": [
"transform-flow-strip-types",
"transform-class-properties"
],
"env": {
"test": {
"plugins": [
"istanbul"
]
}
}
}
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# http://editorconfig.org
root = true

[*]
charset = utf-8
indent_size = 2
end_of_line = lf
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/flow-typed/
/coverage
/dist
26 changes: 26 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"parser": "babel-eslint",
"extends": ["eslint:recommended", "plugin:flowtype/recommended"],
"plugins": ["prettier", "import", "flowtype", "mocha-no-only"],
"env": {
"browser": true,
"es6": true,
"mocha": true,
"amd": true,
"commonjs": true
},
"globals": {
"should": true,
"sinon": true,
"process": true,
"__dirname": true,
"__VERSION__": true,
"__NAME__": true
},
"rules": {
"prettier/prettier": "error",
"mocha-no-only/mocha-no-only": "off",
"require-jsdoc": ["error"],
"valid-jsdoc": ["error"]
}
}
7 changes: 7 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[ignore]
.*/node_modules/**
[include]
[libs]
node_modules/playkit-js/flow-typed/
[options]
unsafe.enable_getters_and_setters=true
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!-- 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/issues): **\_\_**
- [ ] Which Player [version](https://github.com/kaltura/playkit-js/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.
```

```
For media errors reported on Chrome browser, please also paste the output of chrome://media-internals
```
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, weather 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
41 changes: 41 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

.idea/

/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"
}
24 changes: 24 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
sudo: required
dist: trusty
language: node_js
node_js:
- "node"

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

script:
- npm run eslint
- npm run flow
- npm run test
Empty file removed 1.txt
Empty file.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Change Log

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

<a name="1.0.1"></a>
## 1.0.1 (2018-06-06)
124 changes: 124 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# PlayKit JS FLASH - [FLASH] Adapter for the [PlayKit JS Player]

[![Build Status](https://travis-ci.org/kaltura/playkit-js-flash.svg?branch=master)](https://travis-ci.org/kaltura/playkit-js-flash)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)

PlayKit JS Flash adapter integrates [FLASH.HLS] with the [PlayKit JS Player].

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

[flash.hls]: https://github.com/mangui/flashls
[flash.hls configuration]: https://github.com/mangui/flashls#configuration
[flow]: https://flow.org/
[ecmascript6]: https://github.com/ericdouglas/ES6-Learning#articles--tutorials
[babel]: https://babeljs.io

## Getting Started

### Prerequisites

The adapter requires [PlayKit JS Player] to be loaded first.

The adapter uses the [FLASH.HLS] swf library.

[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-flash.git
cd playkit-js-flash
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>
<script type="text/javascript" src="/PATH/TO/FILE/playkit-js-flash.js"></script>
<div id="player-placeholder"" style="height:360px; width:640px">
<script type="text/javascript">
var playerContainer = document.querySelector("#player-placeholder");
var config = {...};
var player = playkit.core.loadPlayer(config);
playerContainer.appendChild(player.getView());
player.play();
</script>
```

## Configuration

[FLASH.HLS] configuration options, documented @[FLASH.HLS API docs], can be passed via the [PlayKit JS Player] config.

The configuration is exposed via the playback section:

```javascript
{
playback:{
options: {
flash: {
swfUrl:// the swf url of flash.hls
flashvars://Object of key value configuration of the flash hls.
params://params for the object tag (e.g window mode)
attributes:// attribute for the object tag
}
}
}
}
```

## 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

target for IE11 on windows 7&8 to allow HLS (Live & Vod)

## 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-flash/tags).

## License

This project is licensed under the AGPL-3.0 License - see the [LICENSE.md](LICENSE.md) file for details
55 changes: 55 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
let webpackConfig = require('./webpack.config.js');
//Need to remove externals otherwise they won't be included in test
delete webpackConfig.externals;
// Need to define inline source maps when using karma
webpackConfig.devtool = 'inline-source-map';

const isWindows = /^win/.test(process.platform);
const isMacOS = /^darwin/.test(process.platform);
// Create custom launcher in case running with Travis
const customLaunchers = {
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox']
}
};

module.exports = function(config) {
let karmaConf = {
logLevel: config.LOG_INFO,
browsers: ['Chrome', 'Firefox'],
concurrency: 1,
singleRun: true,
colors: true,
frameworks: ['mocha'],
files: ['test/setup/karma.js'],
preprocessors: {
'src/**/*.js': ['webpack', 'sourcemap'],
'test/setup/karma.js': ['webpack', 'sourcemap']
},
reporters: ['progress', 'coverage'],
webpack: webpackConfig,
webpackServer: {
noInfo: true
},
client: {
mocha: {
reporter: 'html',
timeout: 50000
}
}
};

if (process.env.TRAVIS) {
karmaConf.customLaunchers = customLaunchers;
karmaConf.browsers = ['Chrome_travis_ci'];
} else {
if (isWindows) {
karmaConf.browsers.push('IE');
} else if (isMacOS) {
karmaConf.browsers.push('Safari');
}
}

config.set(karmaConf);
};
Loading