Skip to content

Commit

Permalink
v1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
justinribeiro committed Nov 15, 2024
1 parent 9cb1af2 commit 5b3391e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- _new in v1.3_: Adds `loading=lazy` to image placeholder for more perf with `posterloading` attr if you'd like to use eager
- _new in v1.4_: Adds `short` attr for enabling experimental YouTube Shorts mobile interaction support. See (example video)[https://www.youtube.com/watch?v=aw7CRQTuRfo] for details.
- _new in v1.5_: Adds support for nonce attribute via `window.liteYouTubeNonce` for CSP 2/3 support.
- _new in v1.6_: Adds `autoPause` for pausing videos scrolled off screen; adds `--lite-youtube-aspect-ratio` CSS custom property create custom aspect ratio videos; adds `--lite-youtube-frame-shadow-visible` CSS custom property to disable frame shadow (flat look); adds a named slot `image` that allows for setting custom poster image; adds `credentialless` for COEP

## Install via package manager

Expand All @@ -47,7 +48,7 @@ import '@justinribeiro/lite-youtube';
If you want the paste-and-go version, you can simply load it via CDN:

```html
<script type="module" src="https://cdn.jsdelivr.net/npm/@justinribeiro/lite-youtube@1.5.0/lite-youtube.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/@justinribeiro/lite-youtube@1/lite-youtube.min.js"></script>
```

## Basic Usage
Expand Down Expand Up @@ -184,6 +185,39 @@ Uses Intersection Observer if available to automatically load the YouTube iframe
></lite-youtube>
```

## Use the named slot to set a custom poster image
```html
<lite-youtube videoid="guJLfqTFfIw">
<img slot="image" src="my-poster-override.jpg">
</lite-youtube>
```

## Set custom aspect ratio
```html
<style>
lite-youtube {
--lite-youtube-aspect-ratio: 2 / 3;
}
</style>
<lite-youtube videoid="guJLfqTFfIw"></lite-youtube>
```

## Disable the frame shadow (flat look)
```html
<style>
lite-youtube {
/* No Shadow */
--lite-youtube-frame-shadow-visible: no;
}
</style>
<lite-youtube videoid="guJLfqTFfIw"></lite-youtube>
```

## Auto-Pause video when scrolled out of view
```html
<lite-youtube videoid="VLrYOji75Vc" autopause></lite-youtube>
```

## YouTube QueryParams

Use any [YouTube Embedded Players and Player Parameters](https://developers.google.com/youtube/player_parameters) you like.
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"lite-youtube.js.map"
],
"license": "MIT",
"version": "1.5.0",
"version": "1.6.0",
"type": "module",
"main": "lite-youtube.js",
"module": "lite-youtube.js",
Expand Down Expand Up @@ -80,4 +80,4 @@
"singleQuote": true,
"arrowParens": "avoid"
}
}
}

0 comments on commit 5b3391e

Please sign in to comment.