Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add player parameter reference note #8

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading