1.0.2 • Published 1 year ago
@cuisine/video-helper v1.0.2
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
Supported providers
- youtube
- vimeo
Example
generateEmbedUrlFromProvider("123456", "youtube")
will output https://www.youtube.com/embed/123456