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

@itkyk/youtube-controller

v2.1.1

Published

Module for easily incorporating iframe API.

Downloads

77

Readme

@itkyk/youtube-controller

Install

$ npm i @itkyk/youtube-controller

Use this module

import YoutubeController from "@itkyk/youtube-controller";

const initi = async() => {
// start Youtube
  const target = document.querySelector("target"); /* <- insert player in this selector*/
  const options = {
      playerVars: {}
  } /* setting YT.Options */
  const player = new YoutubeController("videoId", target, options);
  await player.onYouTubeIframeAPIReady();
  /* ↓ Can use player ↓ */
  player.cueVideoById({
    videoId: "foobar"
  })
  player.playVideo();
}

Initial Methods

  1. onYouTubeIframeAPIReady
    • This function is Promise.
    • when this function return Promise, it mean is onReady too.

Methods that Player has

  1. playVideo
    • Arguments: none.
    • Return: void;
  2. stopVideo
    • Arguments: none.
    • Return: void;
  3. pauseVideo
    • Arguments: none.
    • Return: void;
  4. loadVideoById
    • Arguments:
      • Object
        • videoId:string
        • startSeconds?:number
        • suggestedQuality?:YT.SuggestedVideoQuality
    • Return: void;
  5. loadVideoByUrl
    • Arguments:
      • Object
        • mediaContentUrl:string
        • startSeconds?:number
        • endSeconds?:number
        • suggestedQuality?:YT.SuggestedVideoQuality
    • Return: void;
  6. cueVideoById
    • Arguments:
      • Object
        • videoId: string
        • startSeconds?:number
        • endSeconds?:number
        • suggestedQuality?:YT.SuggestedVideoQuality
    • Return: void;
  7. cueVideoByUrl
    • Arguments:
      • Object
        • mediaContentUrl:string
        • startSeconds?:number
        • endSeconds?:number
        • suggestedQuality?:YT.SuggestedVideoQuality
    • Return: void;
  8. seekTo
    • Arguments:
      • seconds: number,
      • allowSeekAhead:boolean
    • Return: void
  9. nextVideo
    • Arguments: none
    • Return none
  10. previousVideo
    • Arguments: none
    • Return: void playVideoAt
    • Arguments:
      • index: number
    • Return none
  11. mute
    • Arguments: none
    • Return: void
  12. unMute
    • Arguments: none
    • Return: void
  13. isMuted
    • Arguments: none
    • Return: boolean
  14. setVolume
    • Arguments:
      • volume: number
    • Return: void
  15. getVolume
    • Arguments: none
    • Return: number
  16. setSize
    • Arguments:
      • Object
        • width: number
        • height: number
    • Return: void
  17. getPlaybackRate
    • Arguments: none
    • Return number
  18. setPlaybackRate
    • Arguments:
      • suggestedRate: number
    • Return: void
  19. getAvailablePlaybackRates
    • Arguments: none
    • Return: Array
  20. setLoop
    • Arguments:
      • loopPlaylists: boolean
    • Return: void
  21. setShuffle
    • Arguments:
      • shufflePlaylist: boolean
    • Return: void
  22. getVideoLoadedFraction
    • Arguments: none
    • Return: number
  23. getPlayerState
    • Arguments: none
    • Return: YT.PlayerState
  24. getCurrentTime
    • Arguments: none
    • Return: number
  25. getPlaybackQuality
    • Arguments: none
    • Return: YT.SuggestedVideoQuality
  26. setPlaybackQuality
    • Arguments:
      • suggestedQuality:YT.SuggestedVideoQuality
    • Return: void
  27. getAvailableQualityLevels
    • Arguments: none
    • Return: Array<YT.SuggestedVideoQuality>
  28. getDuration
    • Arguments: none
    • Return: number
  29. getVideoUrl
    • Arguments: none
    • Return: string
  30. getVideoEmbedCode
    • Arguments: none
    • Return: string
  31. getPlaylist
    • Arguments: none
    • Return: Array
  32. getPlaylistIndex
    • Arguments: none
    • Return: number
  33. addEventListener
    • Arguments:
      • event: keyof YT.PlayerEvent
      • listener: (event: YT.PlayerEvent)=>void
    • Return: void
  34. removeEventListener
    • Arguments:
      • event: keyof YT.PlayerEvent
      • listener: (event: YT.PlayerEvent)=>void
    • Return: void
  35. getIframe
    • Arguments: none
    • Return: HTMLIFrameElement
  36. destroy
    • Arguments: none
    • Return: void
  37. getPlayer
    • Argument: none
    • Return: YT.Player

Change Log

  • update v2.1.1

    • Change Types to @types/youtube
    • Change option from playerVars to YT.Options
  • update v2.0.7

    • Fixed overwrite condition of onYouTubeIframeAPIReady
  • update v2.0.6

    • Fixed a bug in React that prevented it from working.
  • update v2.0.5

    • Simplified initial setup.
      Also, the onYouTubeIframeAPIReady method has been modified to run correctly.