Merge pull request #1362 from d4rklynk/pr-youtubelite

 Add player parameters for youtubeLite shortcode
This commit is contained in:
Nuno Coração 2024-04-03 22:43:02 +01:00 committed by GitHub
commit ab361bebb9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 29 additions and 6 deletions

View file

@ -739,16 +739,38 @@ A shortcut to embed youtube videos using the [lite-youtube-embed](https://github
<!-- prettier-ignore-start -->
| Parameter | Description |
| --------- | ----------------------------------- |
| --------- | -------------------------------------------- |
| `id` | [String] Youtube video id to embed. |
| `label` | [String] Label for the video |
| `params` | [String] Extras parameters for video playing |
<!-- prettier-ignore-end -->
**Example 1:**
```md
{{</* youtubeLite id="SgXhGb-7QbU" label="Blowfish-tools demo" */>}}
```
{{< youtubeLite id="SgXhGb-7QbU" label="Blowfish-tools demo" >}}
**Example 2:**
You can use all of Youtube's [player parameters](https://developers.google.com/youtube/player_parameters#Parameters) for the `params` variable, as demonstrated below:
> This video will start after 130 seconds (2m10)
```md
{{</* youtubeLite id="SgXhGb-7QbU" label="Blowfish-tools demo" params="start=130" */>}}
```
> This video will not have UI controls, will start playing at 130 seconds and will stop 10 seconds later.
To concatenate multiple options as shown below, you need to add the `&` character between them.
```md
{{</* youtubeLite id="SgXhGb-7QbU" label="Blowfish-tools demo" params="start=130&end=10&controls=0" */>}}
```
{{</* youtubeLite id="SgXhGb-7QbU" label="Blowfish-tools demo" params="start=130&end=10&controls=0" */>}}
More informations can be found on the [youtubeLite GitHub repo](https://github.com/paulirish/lite-youtube-embed/blob/master/readme.md#custom-player-parameters) and Youtube's [player parameters](https://developers.google.com/youtube/player_parameters#Parameters) page.

View file

@ -1,4 +1,5 @@
{{- $id := .Get "id" | default "SgXhGb-7QbU" -}}
{{- $label := .Get "id" | default "Blowfish" -}}
{{- $params := .Get "params" -}}
<lite-youtube videoid="{{ $id }}" playlabel="{{ $label }}"></lite-youtube>
<lite-youtube videoid="{{ $id }}" playlabel="{{ $label }}" params="{{ $params }}"></lite-youtube>