1.1.4 • Published 9 months ago
@cuisine/video-helper v1.1.4
video-helper
Embed url generator for video streaming platforms.
Currently supported platforms:
- youtube
- vimeo
How to install
npm install @cuisine/video-helper
generateEmbedUrl(url: string)
Receives an url from a video provider and returns the provider specific embed url
Supported url formats
- Youtube
- Vimeo
Example
generateEmbedUrl("https://www.youtube.com/watch?v=123456") will output https://www.youtube.com/embed/123456
generateEmbedUrlFromProvider(id: string, provider: VideoProvider)
Receives a video id and a specific provider (from the list of supported providers) and returns the provider specific embed url
isSupported(url: string)
Receives an url and returns if it is supported by the library
isYoutubeShortsUrl(url: string)
Receives an url and returns true if it belongs to a Youtube short
Supported providers
- youtube
- vimeo
Example
generateEmbedUrlFromProvider("123456", "youtube") will output https://www.youtube.com/embed/123456