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

angular-youtube-player

v1.0.3

Published

An Angular component module for using the embedded YouTube iframe player.

Downloads

231

Readme

Angular Embedded YouTube Player Component Module

An Angular component module for using the embedded YouTube (iframe) player.

See Also

Installation

npm install angular-youtube-player

Importing the module

In the module (e.g. AppModule) where it will be used:

/* ... */
import { YTPlayerModule } from 'angular-youtube-player';

@NgModule({
  /* ... */
  imports: [
    YTPlayerModule,
    BrowserModule
  ]
})
export class AppModule { }

Config

There are two options are currently configurable:

// config
imports: [
  YTPlayerModule,
  BrowserModule
],
providers: [{ provide: YTPlayerConfig, useValue: { shouldLoadAPI: true, multiplePlaying: false } }],

You could use either the constructor:

import { YTPlayerConfig } from 'angular-youtube-player';

const useValue = new YTPlayerConfig(shouldLoadAPI, multiplePlaying);

or an object literal:

const useValue = { shouldLoadAPI: true, multiplePlaying: false };

to build the config, both values are optional.

shouldLoadAPI = true

By default using this module would load the YouTube iframe player API, if you prefer to load it on your own, you could set it to false. Note that it would still require the API to be loaded.

multiplePlaying = false

When there are multiple instances of the player, it would only allow one to be playing by default (i.e. playing one would pause the other playing ones). You could set this to true if you want to allow multiple videos playing at the same time.

Using the component

Here's a list of the component's input and output properties:

@Input() videoId: string;
@Input() domId: string;
@Input() parameters: string|YT.PlayerVars;

@Output() ready = new EventEmitter();
@Output() unstarted = new EventEmitter();
@Output() ended = new EventEmitter();
@Output() playing = new EventEmitter();
@Output() paused = new EventEmitter();
@Output() buffering = new EventEmitter();
@Output() cued = new EventEmitter();

Input

videoId

The YouTube video id to play

domId (optional)

The DOM element id of the player

parameters (optional)

The player options, could be a query string or a object

Reference on IFrame Player Parameters

Output

The output events are all from the IFrame Player API.

Other public properties and methods

public get currentTime(): number
public play(): void
public pause(): void
public cueVideoById(videoId: string, startSeconds?: number): void
public loadVideoById(videoId: string, startSeconds?: number): void