Skip to content

Commit

Permalink
doc: framework guides update
Browse files Browse the repository at this point in the history
  • Loading branch information
thijstriemstra committed May 13, 2020
1 parent e1ea30d commit cedaac5
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 50 deletions.
8 changes: 4 additions & 4 deletions docs/angular.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Install the dependencies:
npm install
```

Install and save `videojs-wavesurfer` and `@types/video.js`:
Install `videojs-wavesurfer` and `@types/video.js`:

```console
npm install --save videojs-wavesurfer @types/video.js
Expand Down Expand Up @@ -106,9 +106,9 @@ module.exports = {
}
```

## Sample Project
## Application

Create the `src/app/` directory and add a new Angular component for videojs-wavesurfer
Create the `src/app/` directories and add a new Angular component for videojs-wavesurfer
in `src/app/videojs.wavesurfer.component.ts`:

```ts
Expand Down Expand Up @@ -297,7 +297,7 @@ And finally, create the main index HTML file in `src/index.html`:
Download the [example audio file](https://github.com/collab-project/videojs-wavesurfer/raw/master/examples/media/hal.wav)
and place it in the project directory.

## Run example
## Run

Start the development server:

Expand Down
4 changes: 3 additions & 1 deletion docs/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ player.on('ready', function() {
});
```

# Plugin

| Method | Description |
| ------ | ----------- |
| `destroy` | Destroys the wavesurfer instance and children (including the video.js player). |
Expand All @@ -23,7 +25,7 @@ player.on('ready', function() {
| `exportImage(format, quality)` | Save waveform image as data URI. Default format is `'image/png'`. |
| `setAudioOutput(deviceId)` | Change the audio output device using its [deviceId](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo/deviceId). |

## wavesurfer.js methods
## wavesurfer.js

You can access the wavesurfer instance, for example to call the
wavesurfer.js `seekTo` method, by using the `surfer` property of the
Expand Down
76 changes: 38 additions & 38 deletions docs/react.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,41 @@ use to configure Webpack:
npm install react-app-rewired --save-dev
```

## Configuration

Create a `config-overrides.js` file in the root directory:

```javascript
const webpack = require("webpack");

module.exports = function override(config, env) {
// Extend the config to work with videojs-wavesurfer without ejecting create react app.
// Reference: https://collab-project.github.io/videojs-wavesurfer/#/react
const videojsPlugin = new webpack.ProvidePlugin({
videojs: "video.js/dist/video.cjs.js"
});
const videojsAlias = {
videojs: "video.js",
WaveSurfer: "wavesurfer.js"
};
config.resolve.alias = { ...config.resolve.alias, ...videojsAlias };
config.plugins.push(videojsPlugin);
return config;
};
```

Change the existing calls to `react-scripts` in the `scripts` section of `package.json`
for `start`, `build` and `test`:

```json
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test",
"eject": "react-scripts eject"
}
```

## Application

Edit `src/index.js`:
Expand Down Expand Up @@ -143,7 +178,7 @@ class App extends Component {
export default App;
```

Add this to `src/index.css`:
Add the following to `src/index.css`:

```css
/* change player background color */
Expand All @@ -152,51 +187,16 @@ Add this to `src/index.css`:
}
```

## Webpack configuration

Create a `config-overrides.js` file in the root directory:

```javascript
const webpack = require("webpack");

module.exports = function override(config, env) {
// Extend the config to work with the videojs-wavesurfer project without ejecting create react app.
// Reference: https://github.com/collab-project/videojs-wavesurfer/wiki/React
const videojsPlugin = new webpack.ProvidePlugin({
videojs: "video.js/dist/video.cjs.js"
});
const videojsAlias = {
videojs: "video.js",
WaveSurfer: "wavesurfer.js"
};
config.resolve.alias = { ...config.resolve.alias, ...videojsAlias };
config.plugins.push(videojsPlugin);
return config;
};
```

Change the existing calls to `react-scripts` in the `scripts` section of `package.json`
for `start`, `build` and `test`:

```json
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test",
"eject": "react-scripts eject"
}
```

## Media

Download the [example audio file](https://github.com/collab-project/videojs-wavesurfer/raw/master/examples/media/hal.wav)
and place it in the `public` directory.

## Run example
## Run

Start the development server:

```
```console
npm start
```

Expand Down
1 change: 0 additions & 1 deletion docs/responsive.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ of the window.
- [online demo](https://collab-project.github.io/videojs-wavesurfer/demo/fluid.html)
- [demo source](https://github.com/collab-project/videojs-wavesurfer/blob/master/examples/fluid.html)


## Usage

Configure the player and enable the video.js `fluid` option:
Expand Down
7 changes: 4 additions & 3 deletions docs/vue.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

This page shows how to get started with [Vue.js](https://vuejs.org/) and videojs-wavesurfer.

For more information, check the video.js [documentation](https://github.com/videojs/video.js/blob/master/docs/guides/vue.md) for Vue.js.
For more information, check the video.js [documentation](https://github.com/videojs/video.js/blob/master/docs/guides/vue.md)
for Vue.js.

## Installation

Expand All @@ -25,7 +26,7 @@ cd videojs-wavesurfer-app
npm install --save videojs-wavesurfer
```

## Webpack config
## Configuration

Create `vue.config.js` with the following content:

Expand Down Expand Up @@ -162,7 +163,7 @@ export default {
Download the [example audio file](https://github.com/collab-project/videojs-wavesurfer/raw/master/examples/media/hal.wav)
and place it in the `public` directory.

## Run example
## Run

Start the Vue.js development server:

Expand Down
6 changes: 3 additions & 3 deletions docs/webpack.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Install videojs-wavesurfer:
npm install videojs-wavesurfer
```

## Webpack config
## Configuration

Create the Webpack config file called `webpack.config.js`:

Expand Down Expand Up @@ -59,7 +59,7 @@ module.exports = {
};
```

## Sample project
## Application

Create `src/index.html` containing:

Expand Down Expand Up @@ -169,7 +169,7 @@ document.addEventListener('DOMContentLoaded', function() {
Download the [example audio file](https://github.com/collab-project/videojs-wavesurfer/raw/master/examples/media/hal.wav)
and place it in the root directory.

## Run example
## Run

Start the Webpack development server:

Expand Down

0 comments on commit cedaac5

Please sign in to comment.