All Projects → SamirHodzic → ngx-embed-video

SamirHodzic / ngx-embed-video

Licence: MIT license
Get embed code for embedding youtube/vimeo/dailymotion/* video in websites from URL or ID in Angular 6+.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to ngx-embed-video

php-video-url-parser
A Simple and efficient PHP Video URL Parser that provides you thumbnails and embed codes for various video streaming websites
Stars: ✭ 57 (-1.72%)
Mutual labels:  vimeo, dailymotion
safe-search
Sets the built-in adult content filter (most often: safe search) on Google, YouTube, Bing, Yahoo, DuckDuckGo, Startpage, Dogpile, Yandex, Vimeo, Reddit, Ecosia, Dailymotion, Qwant, and Patreon.
Stars: ✭ 16 (-72.41%)
Mutual labels:  vimeo, dailymotion
oembed
PHP OEmbed wrapper for well-known video platforms and services
Stars: ✭ 26 (-55.17%)
Mutual labels:  vimeo, dailymotion
video-to-markdown
How to embed a video in markdown? Here the answer. Add videos to your markdown files easier.
Stars: ✭ 159 (+174.14%)
Mutual labels:  vimeo, dailymotion
Alltube
Web GUI for youtube-dl
Stars: ✭ 1,925 (+3218.97%)
Mutual labels:  vimeo, dailymotion
React Player
A React component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia and DailyMotion
Stars: ✭ 5,931 (+10125.86%)
Mutual labels:  vimeo, dailymotion
advanced-responsive-video-embedder
Probably the the best WP plugin for embedding videos.
Stars: ✭ 32 (-44.83%)
Mutual labels:  vimeo, embed-videos
Vime
Customizable, extensible, accessible and framework agnostic media player. Modern alternative to Video.js and Plyr. Supports HTML5, HLS, Dash, YouTube, Vimeo, Dailymotion...
Stars: ✭ 1,928 (+3224.14%)
Mutual labels:  vimeo, dailymotion
vlitejs
🦋 vLitejs is a fast and lightweight Javascript library for customizing video and audio player in Javascript with a minimalist theme (HTML5, Youtube, Vimeo, Dailymotion)
Stars: ✭ 162 (+179.31%)
Mutual labels:  vimeo, dailymotion
vembedr
Functions to Embed Video in HTML
Stars: ✭ 56 (-3.45%)
Mutual labels:  vimeo, embed-videos
shareMusic
基于Angular4的音乐播放器
Stars: ✭ 17 (-70.69%)
Mutual labels:  angular4
micro-note
📝 A micro note application
Stars: ✭ 74 (+27.59%)
Mutual labels:  angular4
ng-toggle
Bootstrap-styled Angular Toggle Component
Stars: ✭ 14 (-75.86%)
Mutual labels:  angular4
cookies
Manage your cookies on client and server side (Angular Universal)
Stars: ✭ 40 (-31.03%)
Mutual labels:  angular4
blog-angular
📣 📣 Angular4 + koa2实现的个人博客、Angular blog
Stars: ✭ 60 (+3.45%)
Mutual labels:  angular4
birdchain-mvp
Decentralized application (Dapp) similar to instant messenger. The BIG difference is that it will allow its users to make a monthly passive income, while providing companies with higher quality and better-priced services.
Stars: ✭ 25 (-56.9%)
Mutual labels:  angular4
tcome-frontend
NodeJS&Angular4 BLOG
Stars: ✭ 49 (-15.52%)
Mutual labels:  angular4
ionic-lottie
Sample using ng-lottie and ionic 3 to view animations rendered from After Effects
Stars: ✭ 104 (+79.31%)
Mutual labels:  angular4
ionic2-fixedscroll-directive
An Ionic2+ directive to create cool and fast fixed components on the top of the screen after scrolldown the page. Demo site (Only works with mobile inspector)
Stars: ✭ 15 (-74.14%)
Mutual labels:  angular4
ngx-print
🖨️ A plug n' play Angular (2++) library to print your stuff
Stars: ✭ 124 (+113.79%)
Mutual labels:  angular4

ngx-embed-video

Get embed code for embedding youtube/vimeo/dailymotion/* video in websites from URL or ID in Angular 6+. Currently supports YouTube, Vimeo and Dailymotion. Feel free to make pull request to add others!

npm-url npm-url npm-url build-url Dependencies

Play with ngx-embed-video live on stackblitz.com/ngx-embed-video-example.

Installation

To install ngx-embed-video library, run:

$ npm install ngx-embed-video --save

Consuming EmbedVideo library

and then in your Angular AppModule:

import { HttpClientModule } from '@angular/common/http';
import { EmbedVideo } from 'ngx-embed-video';

@NgModule({
  imports: [HttpClientModule, EmbedVideo.forRoot()]
})
export class AppModule {}

Once your library is imported, you can use it in your Angular application.

Example usage:

import { Component } from '@angular/core';
import { EmbedVideoService } from 'ngx-embed-video';

@Component({
  selector: 'app-component',
  templateUrl: './template.html'
})
export class AppComponent {
  vimeoUrl = 'https://vimeo.com/197933516';
  youtubeUrl = 'https://www.youtube.com/watch?v=iHhcHTlGtRs';
  dailymotionUrl =
    'https://www.dailymotion.com/video/x20qnej_red-bull-presents-wild-ride-bmx-mtb-dirt_sport';

  vimeoId = '197933516';
  youtubeId = 'iHhcHTlGtRs';
  dailymotionId = 'x20qnej';

  constructor(private embedService: EmbedVideoService) {
    console.log(this.embedService.embed(this.vimeoUrl));
    console.log(this.embedService.embed(this.youtubeUrl));
    console.log(this.embedService.embed(this.dailymotionUrl));

    console.log(this.embedService.embed_vimeo(this.vimeoId));
    console.log(this.embedService.embed_youtube(this.youtubeId));
    console.log(this.embedService.embed_dailymotion(this.dailymotionId));
  }
}

Example output:

<iframe
  src="https://player.vimeo.com/video/197933516"
  frameborder="0"
  webkitallowfullscreen
  mozallowfullscreen
  allowfullscreen
></iframe>
<iframe
  src="https://www.youtube.com/embed/iHhcHTlGtRs"
  frameborder="0"
  allowfullscreen
></iframe>
<iframe
  src="https://www.dailymotion.com/embed/video/x20qnej"
  frameborder="0"
  allowfullscreen
></iframe>

<iframe
  src="https://player.vimeo.com/video/197933516"
  frameborder="0"
  webkitallowfullscreen
  mozallowfullscreen
  allowfullscreen
></iframe>
<iframe
  src="https://www.youtube.com/embed/iHhcHTlGtRs"
  frameborder="0"
  allowfullscreen
></iframe>
<iframe
  src="https://www.dailymotion.com/embed/video/x20qnej"
  frameborder="0"
  allowfullscreen
></iframe>

Example usage with sanitized innerHtml iframe:

import { Component } from '@angular/core';
import { EmbedVideoService } from 'ngx-embed-video';

@Component({
  selector: 'app-component',
  template: '<div [innerHtml]="iframe_html"></div>',
})
export class AppComponent {
  iframe_html: any;
  youtubeUrl = "https://www.youtube.com/watch?v=iHhcHTlGtRs";

  constructor(
    private embedService: EmbedVideoService
  ) {
    this.iframe_html = this.embedService.embed(youtubeUrl);
  )
}

Usage

embed(url, [options])

Return an HTML fragment embed code (string) for the given video URL.

embed_vimeo(id, [options])

Return an HTML fragment embed code (string) for the given vimeo video ID.

embed_youtube(id, [options])

Return an HTML fragment embed code (string) for the given youtube video ID.

embed_dailymotion(id, [options])

Return an HTML fragment embed code (string) for the given dailymotion video ID.

embed_image(url, [options])

Returns an HTML <img> tag (string) for the given url and the link in a callback.

{
  link: //img.youtube.com/vi/iHhcHTlGtRs/default.jpg,
  http: html: <img src="http://img.youtube.com/vi/iHhcHTlGtRs/default.jpg" />;
}

Options

query

Object to be serialized as a querystring and appended to the embedded content url.

Example

this.embedService.embed_vimeo('197933516', {
  query: { portrait: 0, color: '333' }
});

Output:

<iframe
  src="https://player.vimeo.com/video/197933516?portrait=0&color=333"
  frameborder="0"
  webkitallowfullscreen
  mozallowfullscreen
  allowfullscreen
></iframe>

attributes

Object to add additional attributes (any) to the iframe

Example

this.embedService.embed('https://youtu.be/iHhcHTlGtRs', {
  query: { portrait: 0, color: '333' },
  attr: { width: 400, height: 200 }
});

Output:

<iframe
  src="https://www.youtube.com/embed/iHhcHTlGtRs?portrait=0&color=333"
  frameborder="0"
  allowfullscreen
  width="400"
  height="200"
></iframe>

Youtube Image options

  • default
  • mqdefault
  • hqdefault
  • sddefault
  • maxresdefault
this.embedService
  .embed_image(
    'https://www.youtube.com/watch?v=iHhcHTlGtRs', 
    { image: 'mqdefault' }
  )
  .then(res => {
    this.thumbnail = res.html;
  });

Vimeo Image options

  • thumbnail_small
  • thumbnail_medium
  • thumbnail_large
this.embedService
  .embed_image(
    'https://vimeo.com/197933516', 
    { image: 'thumbnail_medium' }
  )
  .then(res => {
    this.thumbnail = res.html;
  });

Dailymotion Image options

  • thumbnail_60_url
  • thumbnail_120_url
  • thumbnail_180_url
  • thumbnail_240_url
  • thumbnail_360_url
  • thumbnail_480_url
  • thumbnail_720_url
  • thumbnail_1080_url
this.embedService
  .embed_image(
    'https://www.dailymotion.com/video/x20qnej_red-bull-presents-wild-ride-bmx-mtb-dirt_sport',
    { image: 'thumbnail_720_url' }
  )
  .then(res => {
    this.thumbnail = res.html;
  });

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].