@social-embed/wc
v0.1.0-next.8
Published
A drop-in component for <o-embed> tags
Downloads
2,500
Maintainers
Readme
<o-embed>
·
Web component for URLs of embed-friendly sites such YouTube, Spotify, Vimeo, and so on.
Works any you can use HTML.
Web components are a browser friendly.
No server or service required
URL patterns and ID extraction handled by a separate client-based, browser-friendly package -
@social-embed/lib
- which can even be used independently.
Demo
Examples
Usecases
Dynamic content backends
- users enter a media URL, such as a YouTube link
- HTML content where embeds are saved
HTML Editors This package was originally created for CKEditor's
MediaEmbed
module (see issue ckeditor#2737)Also common is detecting if a URL is embeddable or not, in that case see
@social-embed/lib
See StackOverflow, Regex websites detecting embed URLs(google search: youtube regex site:stackoverflow.com)
Tech
Built in LitElement w/ lit-html + TypeScript. View the source on GitHub.
Compare to thangman22/oembed-component.
Setup
Install dependencies:
npm i @social-embed/wc
yarn add @social-embed/wc
Usage
<o-embed url="https://www.youtube.com/watch?v=G_QhTdzWBJk"></o-embed>