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

framer-youtube-player

v0.0.3

Published

A Framer module for displaying YouTube player.

Downloads

5

Readme

YouTube Player for Framer

Framer module for displaying YouTube videos. It wraps standard YouTube iFrame player, so the player itself can be manipulated in many interesting ways.

screenshot

Examples

TODO: example

Installation

$ cd /your/project.framer
$ npm install framer-youtube-player --save

modules/npm.coffee:

exports.YouTubePlayer = require "framer-youtube-player"

How to use

{YouTubePlayer} = require 'npm'

youtube = new YouTubePlayer
    video: "9bZkp7q19f0"
    width: 400
    height: 225
    playerVars: # see https://developers.google.com/youtube/player_parameters
        autoplay: 1
        controls: 0

You can also subscribe to different events:

youtube.on YouTubePlayer.Events.Loaded, (player, target) ->
	print 'YouTube Loaded'
	player.playVideo() # see https://developers.google.com/youtube/iframe_api_reference#Playback_controls

API

new YouTubePlayer

Instantiates a new instance of YouTubePlayer.

Available options

youtube = new YouTubePlayer
    # all the standard Layer options, like width, height, parent and blur
    video: <string> # YouTube video ID, like "9bZkp7q19f0"
    playerVars: <object>
        autoplay: <number> (0 || 1)
        controls: <number> (0 || 1)
        # see https://developers.google.com/youtube/player_parameters for other options

All the options are optional.

youtube.video

Can set video for playing.

Events

YouTubePlayer supports all the events that standard iframe player supports, as well as special Loaded event.

YouTubePlayer.Events.Loaded

Raises when video is loaded. At this point, you can start using player API.

youtube.on YouTubePlayer.Events.Loaded, (player, targetComponent) ->
    player.seekTo(10)
    player.playVideo()

YouTubePlayer.Events.Ready

Standard onReady event of iframe player.

youtube.on YouTubePlayer.Events.Ready, (event, targetComponent) ->
    player = event.target

YouTubePlayer.Events.StateChange

Standard onStateChange event of iframe player.

youtube.on YouTubePlayer.Events.StateChange, (event, targetComponent) ->
    player = event.target
    state = event.data

State is one of following:

  • -1 (unstarted)
  • 0 (ended)
  • 1 (playing)
  • 2 (paused)
  • 3 (buffering)
  • 5 (video cued)

YouTubePlayer.Events.PlaybackQualityChange

Standard onPlaybackQualityChange event of iframe player.

youtube.on YouTubePlayer.Events.PlaybackQualityChange, (event, targetComponent) ->
    player = event.target
    quality = event.data

Quality is one of following strings:

  • small
  • medium
  • large
  • hd720
  • hd1080
  • highres

YouTubePlayer.Events.PlaybackRateChange

Standard onPlaybackRateChange event of iframe player.

youtube.on YouTubePlayer.Events.PlaybackRateChange, (event, targetComponent) ->
    player = event.target
    playbackRate = event.data

YouTubePlayer.Events.Error

Standard onError event of iframe player.

youtube.on YouTubePlayer.Events.Error, (event, targetComponent) ->
    player = event.target
    errorCode = event.data

YouTubePlayer.Events.ApiChange

Standard onApiChange event of iframe player.

youtube.on YouTubePlayer.Events.ApiChange, (event, targetComponent) ->
    player = event.target
    options = player.getOptions 'captions'

Tips

You can set parent layer for YouTubePlayer, so it will be handy to move it around. Currently the Framer Studio's AutoCode feature does not work with custom modules.

layerA = new Layer # editable with AutoCode
	x: 200
	y: 300
	width: 400
	height: 225

youtube = new YouTubePlayer
	parent: layerA
	video: "9bZkp7q19f0"
	width: 400
	height: 225