embed-detector

0.3.3 • Public • Published

Embed Detector

Really simple package to return a URL for an iFrame for media content. Supports SoundCloud, Vimeo & YouTube links so far.

The regex could be a lot better, still very much a WIP.

npm install embed-detector
import EmbedDetector from 'embed-detector';

let iFrameUrl = EmbedDetector.detect('https://www.youtube.com/watch?v=mKq2nlV4DYk');
// Returns the correct URL for iFrame

let linkSource = EmbedDetector.getSourceType('https://www.youtube.com/watch?v=mKq2nlV4DYk');
// Returns 'youtube'

let isMediaLink = EmbedDetector.qualifySource('https://www.youtube.com/watch?v=mKq2nlV4DYk');
// Returns true

This package can also be used in the browser with a regular <script> tag.

Readme

Keywords

Package Sidebar

Install

npm i embed-detector

Weekly Downloads

0

Version

0.3.3

License

ISC

Last publish

Collaborators

  • timnovis