npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gsvideoframe

v1.3.1

Published

Iframe embedded popups for common Video providers

Downloads

5

Readme

Gigasavvy VideoFrame jQuery Plugin

Iframe embedded popups for common Video providers

Installation

NPM

npm install gsvideoframe --save

Yarn

yarn add gsvideoframe --save

Demo

See a live demo.

Usage

Include jQuery

<script type="text/javascript" src="http://code.jquery.com/jquery-3.3.1.min.js"></script>

Include gsVideoFrame

<script type="text/javascript" src="./dist/scripts/gsVideoFrame.min.js"></script>

Options

  • src (string)
    • The src attribute is the URL to view the video.
      • The script will parse YouTube and Vimeo URL's and will create an iFrame embed from them.
      • Note: YouTube URL's with .com and .be are currently supported.
  • autoplay (number) [Default 1]
    • This parameter determines whether or not the video automatically plays once it is opened
  • params (object)
  • target (string | jQuery object) [Default false]
    • The target where the video should be embedded.
      • This can be a selector string (ex: "#gsVideoFrame")
      • Or this can be a jQuery object (ex: $('#gsVideoFrame')).
      • In the default case false or if the target cannot be found, the video will be appended to the body element.
  • esc (boolean)
    • Determines whether to add an event observer to listen for the escape key to close the video.
  • time (object)
    • Object that defines animation timing
      • fadeIn [Default 250] - Time for video fade-in animation
      • fadeOut [Default 250] - Time for video fade-out animation
  • class (object)
    • Object that defines HTML classes used throughout the script
      • opening [default gsvideoframe-opening] - Class applied to content as it is opening
      • closing [default gsvideoframe-closing] - Class applied to content as it is closing
      • iframe [default gsvideoframe-frame] - Class applied to embedded iFrame
  • id (string)
    • Unique HTML ID given to the embedded iFrame
      • This defaults to "video" plus a timestamp
  • container (string | jQuery object)
    • HTML / Element to be used as the frame container. Use false to prevent the script from wrapping your content in a container
  • closeButton (string | jQuery object)
    • HTML / Element to be used as the close button. Use false to remove the close button

Example:

$('#element').gsVideoFrame({
  params: {
    api: {
      color: 'white'
    }
  },
  class: {
    iframe: 'video-player'
  },
  src: 'https://www.youtube.com/watch?v=Rk6_hdRtJOE',
  autoplay: 1
});

Events

To create event listeners, pass an anonymous function as an option.

  • gsvf:apiload
    • Event called when the player API is loaded
  • gsvf:beforeopen
    • Event called before the video is embedded
  • gsvf:open
    • Event called after the video is embedded
  • gsvf:play
    • Event called when the video is played
  • gsvf:pause
    • Event called when the video is paused
  • gsvf:ended
    • Event called when the video has finished playing
  • gsvf:ready
    • Event called when the video is ready
  • gsvf:error
    • Event called when an error has occurred
  • gsvf:beforeclose
    • Event called before the video is closed
  • gsvf:close
    • Event called after the video is closed
  • gsvf:destroy
    • Event called when the player is "destroyed"

Example:

$('#element').on('gsvf:ready', function(event, options) {
  if (options.type == 'vimeo') {
    options.player.on('timeupdate', function(data) {
      console.log('Time Update:');
      console.log(data);
    })
  }
});

Accessing the Player

The player can be accessed via the player property of the gsvideoframe object. The player object will vary depending on which video provider the video is initialized with.

Example:

$('#element').data('gsvideoframe').player.pauseVideo()

API

To utilize API methods, you can access the gsvideoframe data of the element used to initiate gsVideoFrame.

Example:

$('#element').gsVideoFrame({ ...options });
$('#element').data('gsvideoframe').close();
$('#element').data('gsvideoframe').seek(123);

Issues / Feedback

Please feel free to submit any issues you encounter or share your ideas :blush:

Submit Issues / Give Feedback