diff --git a/.babelrc b/.babelrc
new file mode 100644
index 0000000..47a615d
--- /dev/null
+++ b/.babelrc
@@ -0,0 +1,3 @@
+{
+ "presets": [ "env" ]
+}
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..009885a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+node_modules
+es5/
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..e0dc64f
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,32 @@
+sudo: false
+dist: trusty
+language: node_js
+node_js:
+ - 'node'
+before_script:
+
+ # Check if the current version is equal to the major version for the env.
+ - 'export IS_INSTALLED="$(npm list video.js | grep "video.js@$VJS")"'
+
+ # We have to add semicolons to the end of each line in the if as Travis runs
+ # this all on one line.
+ - 'if [ -z "$IS_INSTALLED" ]; then
+ echo "INSTALLING video.js@>=$VJS.0.0-RC.0 <$(($VJS+1)).0.0";
+ npm i "video.js@>=$VJS.0.0-RC.0 <\$(($VJS+1)).0.0";
+ else
+ echo "video.js@$VJS ALREADY INSTALLED";
+ fi'
+ - export CHROME_BIN=/usr/bin/google-chrome
+ - export DISPLAY=:99.0
+ - sh -e /etc/init.d/xvfb start
+env:
+ - VJS=5
+ - VJS=6
+addons:
+ firefox: latest
+ apt:
+ sources:
+ - google-chrome
+ packages:
+ - google-chrome-stable
+
diff --git a/README.md b/README.md
index 30dd884..85d325b 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ Video.js tech to use [flv.js](https://github.com/Bilibili/flv.js) for FLV playba
Check out the flv.js docs for details on its capabilities, browser support etc. Note that you need [CORS headers](https://github.com/Bilibili/flv.js/blob/master/docs/cors.md) if your video is being hosted at a different origin.
-[Example](https://github.com/mister-ben/videojs-flvjs)
+[Example](https://mister-ben.github.io/videojs-flvjs/)
## Installation
@@ -14,54 +14,36 @@ npm install --save videojs-flvjs
## Usage
-To include videojs-flvjs on your website or web application, use any of the following methods.
-
-### `
-
+
+
+
+
```
-You only need to set the techOrder in Video.js version 5. In version 6 techs add themselves to the default techorder. If you are using both the flash and flvjs techs, flvjs should come first.
-
-### Browserify
-
-When using with Browserify, install videojs-flvjs via npm and `require` the plugin as you would any other module.
-
-```js
-var videojs = require('video.js');
-
-// The actual plugin function is exported by this module, but it is also
-// attached to the `Player.prototype`; so, there is no need to assign it
-// to a variable.
-require('videojs-flvjs');
-
-var player = videojs('my-video');
-
-player.flvjs();
-```
-
-### RequireJS/AMD
-
-When using with RequireJS (or another AMD library), get the script in whatever way you prefer and `require` the plugin as you normally would:
-
-```js
-require(['video.js', 'videojs-flvjs'], function(videojs) {
- var player = videojs('my-video');
-
- player.flvjs();
-});
-```
-
## License
Apache-2.0. Copyright (c) mister-ben
diff --git a/package.json b/package.json
index 9a5eb67..e0f8698 100644
--- a/package.json
+++ b/package.json
@@ -29,7 +29,8 @@
"preversion": "npm test",
"version": "babel-node scripts/version.js",
"postversion": "babel-node scripts/postversion.js",
- "prepublish": "npm run build"
+ "prepare": "npm run build",
+ "prepush": "npm run lint"
},
"keywords": [
"videojs",
@@ -86,7 +87,7 @@
"devDependencies": {
"babel-cli": "^6.14.0",
"babel-plugin-transform-object-assign": "^6.8.0",
- "babel-preset-es2015": "^6.14.0",
+ "babel-preset-env": "^1.6.0",
"babelify": "^7.3.0",
"bannerize": "^1.0.2",
"bluebird": "^3.2.2",
@@ -96,9 +97,9 @@
"bundle-collapser": "^1.2.1",
"chg": "^0.3.2",
"flv.js": "^1.1.0",
- "ghooks": "^1.3.2",
"glob": "^6.0.3",
"global": "^4.3.0",
+ "husky": "^0.14.3",
"karma": "^0.13.19",
"karma-chrome-launcher": "^0.2.2",
"karma-detect-browsers": "^2.0.2",
@@ -115,10 +116,5 @@
"sinon": "~1.14.0",
"uglify-js": "^2.6.1",
"videojs-standard": "^4.0.0"
- },
- "config": {
- "ghooks": {
- "pre-push": "npm run lint"
- }
}
}
diff --git a/src/plugin.js b/src/plugin.js
index 366914b..8534e74 100644
--- a/src/plugin.js
+++ b/src/plugin.js
@@ -24,11 +24,13 @@ class Flvjs extends Html5 {
this.flvPlayer.detachMediaElement();
this.flvPlayer.destroy();
}
- this.flvPlayer = window.flvjs.createPlayer({
- type: 'flv',
- url: src,
- cors: true
- });
+
+ const mediaDataSource = this.options_.mediaDataSource;
+ const config = this.options_.config;
+
+ mediaDataSource.type = mediaDataSource.type === undefined ? 'flv' : mediaDataSource.type;
+ mediaDataSource.url = src;
+ this.flvPlayer = window.flvjs.createPlayer(mediaDataSource, config);
this.flvPlayer.attachMediaElement(this.el_);
this.flvPlayer.load();
}