Skip to content

Commit

Permalink
Merge branch 'feature/audio-loading'
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldzjap committed Aug 30, 2018
2 parents 577f3fc + 2fee419 commit 7c6e049
Show file tree
Hide file tree
Showing 11 changed files with 2,172 additions and 2,253 deletions.
5 changes: 1 addition & 4 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"presets": [
["env", {"modules": false}],
"stage-0"
]
"presets": ["@babel/preset-env"]
}
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,12 @@ View the code for a full playlist example [here](/example/src/playlist.js)
| `container` | mixed | `null` | **Required**: CSS-selector or HTML-element for displaying the waveform. |
| `height` | integer | `128` | The height of the waveform in pixels. |
| `interact` | boolean | `true` | Enables/disables mouse interaction with the waveform view. This may be changed at any point after creation. |
| `preload` | string | `metadata` | The value of the preload attribute of the audio element. |
| `progressColor` | string | `#31708f` | The fill color of the waveform bars that have been played back so far. |
| `responsive` | boolean | `true` | If set to true, the width of the waveform view adapts to the width of the container element. |
| `useGradient` | boolean | `true` | Indicates if the waveform should be drawn with a gradient or not. |
| `waveColor` | string | `#428bca` | The fill color of the waveform bars that have not been played back so far. |
| `width` | integer | 512 | The width of the waveform in pixels (only relevant when the `responsive` option is set to `false`). |
| `width` | integer | `512` | The width of the waveform in pixels (only relevant when the `responsive` option is set to `false`). |

## waveplayer.js Methods
* `cancelPlaylist()`
Expand Down Expand Up @@ -121,6 +122,20 @@ View the code for a full playlist example [here](/example/src/playlist.js)
`url` is a valid URL to an audio file.

`data` (**optional**) is an array or object containing waveform data. If it is not supplied, the waveform data is extracted from the JSON file. If `data` is an object it is expected that the first key points to an array of waveform values. Note that only the first key found in the object is queried for waveform data.
* `loadAudio(url)`

Load an audio file from a URL without loading the waveform data and rendering the waveform.

**Arguments**:

`url` is a valid URL to an audio file.
* `loadWaveform(data)`

Load the waveform data from a URL to a JSON file or explicitly provided waveform data without loading the audio file.

**Arguments**:

`data` is either a string representing a valid URL to a JSON file containing the waveform data or an array or object containing waveform data.
* `interact` or `interact = bool`

Setter or getter for enabling/disabling mouse interaction with the waveform view.
Expand Down
2 changes: 1 addition & 1 deletion example/.babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"presets": ["env", "stage-0"]
"presets": ["@babel/preset-env"]
}
2,246 changes: 1,195 additions & 1,051 deletions example/package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"description": "A playlist example for waveplayer.js",
"main": "dist/playlist.js",
"scripts": {
"build": "node -r babel-register ./node_modules/.bin/webpack --progress --hide-modules",
"watch": "node -r babel-register ./node_modules/.bin/webpack --watch --progress --hide-modules"
"build": "node -r @babel/register ./node_modules/.bin/webpack --progress --hide-modules",
"watch": "node -r @babel/register ./node_modules/.bin/webpack --watch --progress --hide-modules"
},
"repository": {
"type": "git",
Expand All @@ -25,15 +25,15 @@
},
"homepage": "https://github.com/michaeldzjap/waveplayer.js#readme",
"devDependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-preset-env": "^1.7.0",
"babel-preset-stage-0": "^6.24.1",
"babel-register": "^6.26.0",
"webpack": "^4.16.5",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/register": "^7.0.0",
"babel-loader": "^8.0.0",
"webpack": "^4.17.1",
"webpack-cli": "^3.1.0"
},
"dependencies": {
"@babel/runtime": "^7.0.0",
"@fortawesome/fontawesome-free-webfonts": "^1.0.9",
"bulma": "^0.7.1"
}
Expand Down
Loading

0 comments on commit 7c6e049

Please sign in to comment.