## video

### Setup

Make sure your yarn and node versions are up to date:

```bash
brew upgrade node
brew upgrade yarn
```

Get the application running:

```bash
cp .env.shadow .env # initialize environment configuration
edit .env and add grass token
yarn --frozen-lockfile # install all dependencies
yarn start:video # start dev server
```

To see all available tasks, run `yarn run`.

The default settings are set to vendorId=16156 (RB2 Test Label) so get a grass token as that vendor.
(at https://workstation.qaorch.com/grasssession)


### Embedding in frontend-distribution

To run this locally in a local frontend distribution start both servers with yarn.  Put one on a different port, lets say frontend-video on 8081 (through the .env file).  In frontend-distrubution open video-product-form.js.  In the call to getBundleAndMount add a hash key value to the first argument `localhostPort: 8081,`.


If you want to run ows-video locally as well you can run the following command:

```
yarn start:video:localows
```

It will add the following code to the local node server in server.js. You'll need to make sure
you have ows-video running first :-).

```
app.get('/grass/product/product/*', (_r, res) => res.send({
    status: 'label_processing',
    vendorId: 16156,
    subaccountId: 0,
    deletions: 'N',
}));

app.use('/grass/video', proxy('http://localhost:5000', {
    proxyReqPathResolver: req => (
        url.parse(req.url.replace(/(session=)[^&]+/, '')).path
    )
}));
```

to lib/dev-server/server.js right above the `app.use('/grass', proxy` line.
