• This repository has been archived on 22/Oct/2020
  • Stars
    star
    609
  • Rank 73,614 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Fluid width for YouTube, Vimeo, Vine, VideoPress, DailyMotion, and more embedded videos.

SuperEmbed.js

Live demo now available here.

SuperEmbed.js detects embedded videos from YouTube, Vimeo, Vine, VideoPress, DailyMotion, and more on webpages and makes them responsive. Essentially, this means they stretch to fill their container while still maintaining the content's original aspect ratio.

I created SuperEmbed to fix all my issues with existing solutions, including (but not limited to) unnecessary reliance on other libraries, bloated code, and poor fallback support.

Features

  • Works without external libraries like JQuery
  • Responsive videos maintain their original aspect ratio
  • Responsive layout can be forced or blocked with classes applied to the embed code
  • Extremely tiny, the minified version is only 3 KB

Supported Services

SuperEmbed can automatically detect and resize embedded content from these sites:

  • YouTube
  • Vimeo
  • SoundCloud
  • Kickstarter
  • CollegeHumor
  • Hulu
  • Flickr
  • Vine
  • VideoPress
  • DailyMotion
  • Twitch.tv
  • Vid.me
  • Facebook
  • Gfycat
  • LiveLeak
  • MSDN Channel 9
  • MySpace
  • Archive.org

Browser support

Chrome Internet Explorer Firefox Safari Opera
4.0+ 9.0+ (see note) 3.5+ 3.2+ 10+

IE9 compatibility requires classList.js, included in the 'extras' folder, to be loaded before SuperEmbed.js. This is not needed for IE10 and up.

How to use

You can put the SuperEmbed script wherever you want on the page:

<script src="superembed.min.js"></script>

Then it will automatically resize any supported embedded videos. That's it.

Note: If you already use JQuery, and you load SuperEmbed sometime after it, SuperEmbed will use JQuery to detect when the page is loaded and the window is resized (instead of DOM JavaScript).

Advanced features

If you want to make an embedded video (or really any element) responsive, but it's not automatically detected by SuperEmbed, you can add the .superembed-force class to it like this:

<iframe src="http://www.example.com/video" class="superembed-force"></iframe>

You can also tell SuperEmbed to not resize a specific embed by adding the .superembed-ignore class, like this:

<iframe src="http://www.example.com/video" class="superembed-ignore"></iframe>

And finally, you can force a 1:1 aspect ratio by adding the .superembed-square class, like this:

<iframe src="http://www.example.com/video" class="superembed-square"></iframe>

New in SuperEmbed.js 3.1:

  • Added support for SoundCloud and MSDN Channel 9 embeds

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

nexus-tools

Installer for ADB, Fastboot, and other Android tools on Linux, macOS, Chrome OS, and Windows
Dart
831
star
2

creative-cloud-linux

PlayOnLinux install script for Adobe Creative Cloud
Shell
755
star
3

wii-shop-extension

Browser extension that plays the Wii Shop theme when you visit shopping websites.
JavaScript
347
star
4

link-cleaner

Progressive Web App for removing tracking code and other variables from web links
HTML
123
star
5

peek

Preview documents, videos, music, and more with a mouse hover.
JavaScript
87
star
6

imageshare

A lightweight web app for uploading images, created for the Nintendo 3DS and other legacy web browsers.
PHP
81
star
7

tootbot

Python tool for mirroring Reddit posts to Twitter and Mastodon
Python
70
star
8

share-to-mastodon

Browser extension for sharing links and tabs to Mastodon (and other Fediverse platforms)
JavaScript
62
star
9

wikipedia-search

Search Wikipedia from the browser search bar and context menu
JavaScript
55
star
10

photostack

Progressive Web App for editing multiple photos at once.
JavaScript
54
star
11

yosemite-chrome

Chrome theme for Mac OS X Yosemite
35
star
12

whatdevice

Progressive Web App that displays hardware and software information, with one-click sharing.
JavaScript
33
star
13

nimbus

Nimbus is a simple and powerful weather app for Android, Firefox, and Chrome.
JavaScript
27
star
14

noplugin

Play legacy media in modern browsers without plugins.
JavaScript
27
star
15

cobalt

Lightweight operating system based on FreeDOS
Batchfile
20
star
16

mini-google-tasks

Open Google Tasks from your browser's toolbar and sidebar.
CSS
13
star
17

pip-shortcut

Browser extension that adds keyboard shortcut and toolbar button for Picture-in-Picture mode
HTML
12
star
18

planr

Planr is a simple and powerful planner app for Android, Firefox, Chrome, and the web.
JavaScript
10
star
19

tipjar

Browser extension that makes it easy to donate to your favorite sites and creators.
JavaScript
9
star
20

rockwell

Cross-platform assembly code emulator for the 6502 CPU.
JavaScript
8
star
21

shop-list

List of shopping websites
Dart
7
star
22

periscopejs

PeriscopeJS is a JavaScript library to interact with Periscope.
JavaScript
6
star
23

pluto-editor

WYSIWYG editor for Markdown files as a Progressive Web App
JavaScript
6
star
24

web-system

A web based clone of the Classic Macintosh operating system.
CSS
5
star
25

metrodeck

MetroDeck enhances TweetDeck with the Metro UI and other improvements.
CSS
5
star
26

snappy

Web app for automatically capturing screenshots
HTML
4
star
27

cacheview

Find cached web pages from Google web cache, the Wayback Machine, and Google AMP.
JavaScript
3
star
28

cupertino

A Firefox theme designed to match the macOS color scheme and design.
3
star
29

nova-builder

Easy to use Minecraft modpack builder for the Technic Launcher
Shell
2
star
30

oldsite

My website
HTML
2
star
31

podcast-producer

Tool for exporting podcasts in multiple formats with metadata
2
star
32

winten

Chrome theme designed for Windows 10.
2
star
33

rewind

A command-line tool for retrieving cached web pages, written in Dart.
Dart
2
star
34

discourse

Browser extension for viewing discussions across the web
1
star
35

video-screenshot

Capture screenshots from any video in your browser
1
star
36

corbindavenport.github.io

Website for Corbin Davenport
CSS
1
star
37

vault

Collection of early web projects
HTML
1
star
38

alt-text-creator

Browser extension that generates alternate text for images using GPT-4 Vision.
JavaScript
1
star