Skip to content

Commit

Permalink
make sure the rollup package is autoplay with sound on
Browse files Browse the repository at this point in the history
  • Loading branch information
jermspeaks committed Oct 6, 2017
1 parent 06e1015 commit 0dce452
Show file tree
Hide file tree
Showing 6 changed files with 257 additions and 13 deletions.
7 changes: 2 additions & 5 deletions dist/main.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"license": "MIT",
"private": false,
"scripts": {
"open": "python -m SimpleHTTPServer 8089",
"build": "./node_modules/.bin/rollup -c",
"build:production": "NODE_ENV=production ./node_modules/.bin/rollup -c"
},
Expand All @@ -20,6 +21,7 @@
"babel-preset-minify": "^0.2.0",
"rollup": "^0.50.0",
"rollup-plugin-babel": "^3.0.2",
"rollup-plugin-cleanup": "^1.0.1",
"rollup-plugin-node-resolve": "^3.0.0"
}
}
1 change: 0 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export default {
format: 'umd',
name: 'autoplayDetector'
},
sourcemap: 'inline',
plugins: [
resolve(),
babel({
Expand Down
9 changes: 3 additions & 6 deletions src/autoplayWithSound.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import { video as videofile } from './video';
import * as utils from './commonUtils';
// import * as utils from './commonUtils';

export default canAutoplay;

const canAutoplay = () =>
new Promise((resolve, reject) => {
let supportsAutoplay;

// const cleanUp = video => document.body.removeChild(video);

const cleanUp = video => document.body.removeChild(video);
const afterPlay = (resolution) => video => () => {
utils.cleanUp(video);
cleanUp(video);
resolve(resolution);
}

const successPlay = afterPlay(true);
const failPlay = afterPlay(false);

Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// export { default as canAutoplayWithSound } from './autoplayWithSound';
export { default as canAutoplay } from './autoplay';
export { default as canAutoplay } from './autoplayWithSound';
Loading

0 comments on commit 0dce452

Please sign in to comment.