Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

better-video-embeds

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

better-video-embeds

Pass in a url that should be a video embed link...and get back a properly formated embed link. (Works for YouTube, Vimeo, Wistia and more!)

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
255
increased by38.59%
Maintainers
1
Weekly downloads
 
Created
Source

Better Video Embeds

Pass in a url that should be a video embed link...and get back a properly formated embed link. (Works for YouTube, Vimeo, Wistia and more!)

Blazing Fast Blazing Fast Blazing Fast

npm i better-file-downloader yarn add better-file-downloader

View on NPM

For example:

https://www.youtube.com/watch?v=O9ydMYA8dmw becomes https://www.youtube.com/embed/O9ydMYA8dmw

The api currently supports parsing out the following embed strings:

  • YouTube
  • Vimeo
  • Matterport
  • Daily motion
  • Wistia

The library works with react and is fairly lightweight in size.

You'll be converting your users dirty video links scripts into embed links that you can iframe in no time!

Examples

import getEmbedUrl from 'better-video-embeds';
const getEmbedUrl = require('better-video-embeds');

const embedLink = getEmbedUrl('https://www.youtube.com/watch?v=O9ydMYA8dmw');
import getEmbedUrl from 'better-video-embeds';
const getEmbedUrl = require('better-video-embeds');

const embedLink = getEmbedUrl('https://www.youtube.com/watch?v=O9ydMYA8dmw', {
  includeModestYouTubeBranding: true,
});
import React, { useState } from 'react';
import getEmbedUrl from 'better-video-embeds';

export default function example() {
  const [videoLink, setVideoLink] = useState('');

  const submit = event => {
    event.preventDefault();
    const embedLink = getEmbedUrl(videoLink);
    console.log(embedLink);
  };

  return (
    <form onSubmit={submit}>
      <input
        value={videoLink}
        type="text"
        onChange={event => setVideoLink(event.target.value)}
      />
      <button type="submit">Save!</button>
    </form>
  );
}

Keywords

FAQs

Package last updated on 09 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc