Skip to content

Commit

Permalink
docs: Add player parameter reference note (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
Techassi authored Jan 9, 2024
1 parent 7c9a912 commit 23c06c8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
1 change: 1 addition & 0 deletions .vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default defineConfig({
message: 'Released under the <a href="https://github.com/vue-youtube/vue-youtube/blob/main/LICENSE">MIT License</a>.',
copyright: 'Copyright © 2020-present <a href="https://github.com/Techassi">Techassi</a>'
},
outline: [2, 3]
},
sitemap: {
hostname: 'https://vue-youtube.github.io/docs/'
Expand Down
30 changes: 23 additions & 7 deletions src/usage/composable.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Composable

[player-param-reference]: https://developers.google.com/youtube/player_parameters#Parameters

## Usage

::: tip Hint
Expand Down Expand Up @@ -327,14 +329,14 @@ usePlayer('dQw4w9WgXcQ', player, {
});
```

**Supported Options**
### Supported Options

| Option | Details |
| ------------ | ---------------------------------------------------------------------------------------------------------------------------- |
| `playerVars` | Customize the player behavior, see [here](https://developers.google.com/youtube/player_parameters#Parameters) for reference. |
| `cookie` | When this option is `true` the host `https://www.youtube.com` is used, otherwise `https://www.youtube-nocookie.com` |
| `width` | Set the width of the YouTube player. Number and string supported. |
| `height` | Set the height of the YouTube player. Number and string supported. |
| Option | Details |
| ------------ | ------------------------------------------------------------------------------------------------------------------- |
| `playerVars` | Customize the player behavior, see [hereplayer-param-reference][player-param-reference] for reference. |
| `cookie` | When this option is `true` the host `https://www.youtube.com` is used, otherwise `https://www.youtube-nocookie.com` |
| `width` | Set the width of the YouTube player. Number and string supported. |
| `height` | Set the height of the YouTube player. Number and string supported. |

::: details Show Type Declarations
```ts
Expand Down Expand Up @@ -389,6 +391,20 @@ export interface PlayerVars {
```
:::

### `playerVars` Reference <Badge type="warning" text="New" />

::: info Info
This section will soon feature a full reference. See [#7](https://github.com/vue-youtube/docs/issues/7) for more
information on implementation progress.
:::

It is important to look up the official YouTube [player parameter reference][player-param-reference]. Some parameters
might oppose unexpected requirements on the provided value. Invalid values might render the player inoperable.

Such an example is the `start` parameter which is typed as a `number` in TS. In JavaScript (and thus also in Typescript)
a `number` can be any *kind* of number, like integer or float. The parameter however expects integer values, otherwise
the player won't start playing the video.

## Examples

### Dynamically change the video ID
Expand Down

0 comments on commit 23c06c8

Please sign in to comment.