# Nonstop Javascript SDK

## Should Watch Nonstop

Can be called to determine whether for a given user at a given time whether they should receive a Nonstop stream.

### When to call it

`shouldWatchNonstop` should be called prior to resuming episodes or movies when the user is logged in. The client should wait for a result before proceeding.

`shouldWatchNonstop` is not required for Live, VPPO clips or ShowMS clips. When called for non-valid content or when no user logged in it will simply return false.

### How to call it

```javascript
    Nonstop.default.shouldWatchNonstop('VDKA4220171', false)
        .then((watchNonstopResult) => {
            // Check result to see whether to play Nonstop or Standard
            // watchNonstopResult.shouldWatchNonstop
        })
        .catch(() => {
            // Something went wrong - should watch Standard
        });
```

* **contentId** - the PartnerAPIId of the content the user has selected to watch
* **performLocalLookup** - If this value is set to true, the SDK will perform a local lookup for checking whether the user has a valid purchase for this content or not. This should be used in scenarios where it is not necessary to fully verify that the user has a valid purchase, for example, when displaying a Nonstop Icon in the user's continue watching row. If the value is false, the SDK performs a full check with the server as to whether the user has a valid purchase for this piece of content. This should continue to be used when the user resumes a piece of content to ensure a full check is performed.

#### Response is true

When the client application receives true for the `shouldWatchNonstop` property of the `watchNonstopResult` it means that the user should watch the selected content Nonstop. This could be for a number of reasons:

* because they are within their grace period for this piece of content
* because this piece of content has been given to all users by a particular sponsor

The client application should instruct the player to commence with a reduced ad load by passing the `cbp` parameter with a value of `1` into the player creation params.

#### Response is false or error

When the client application receives false for `watchNonstopResult.shouldWatchNonstop` it means that the user should watch the selected content with the standard ad load. This could be for a number of reasons:

* the user has not purchased this content
* this piece of content is not eligible to watch Nonstop
* an error has occurred that is best to be handled by just playing the stream with standard ad load

The client application should instruct the player to commence with a normal ad load by not passing `0` for the `cbp` parameter (or omitting it) when creating the player.