Skip to content

ngx-lite-video is an Angular package for lazy loading embedded YouTube and Vimeo videos, improving page speed and user experience.

License

Notifications You must be signed in to change notification settings

KSmp/ngx-lite-video

 
 

Repository files navigation

ngx-lite-video-v2

ngx-lite-video-v2 is updated version of ngx-lite-video.

ngx-lite-video is an Angular package that provides lazy loading capabilities for embedded iframes from popular video sharing platforms like YouTube and Vimeo. The package is designed to optimize the loading of embedded videos, improving page load times and reducing data usage.

The package is built specifically for Angular, utilizing Angular's onpush change detection strategy for efficient rendering and updating of video components. It also includes features such as customizable lazy loading thresholds and options for controlling video playback and display.

This package requires a minimum of Angular version 17 and rxjs version 7.8.2 to function properly.

Try it yourself by measuring the performance on original author's Demo page

Key Features

  • Lazy loads embedded iframes for YouTube and Vimeo videos
  • Built specifically for Angular
  • Uses Angular OnPush change detection for optimized performance
  • Customizable options including video quality, start time, and more
  • Provides a seamless user experience by loading videos only when needed

Install

npm install ngx-lite-video-v2 --save

Once installed, import the module that you wish to use in your desired component

@Component({
  //...
  imports: [
    //...
    NgxLiteVimeoComponent, // Vimeo lite component
    NgxLiteYoutubeComponent, // YouTube lite component
  ],
})
export class YourComponent {}

Usage

To use ngx-lite-video, add the 'ngx-lite-youtube'/'ngx-lite-vimeo' component to your template and configure its properties as needed:

<!-- YouTube Component -->
<ngx-lite-youtube videoId="Ys7xdebd66Y"></ngx-lite-youtube>

<!-- Vimeo Component -->
<ngx-lite-vimeo videoId="786570322"></ngx-lite-vimeo>

Custom styles

To override styling create a class in global style.scss file & provide it to styleClass attribute

For more detailed examples see Demo page


API

YouTube Attributes

Property Type Default Description
videoId string undefined Video ID to be viewed
videoTitle string undefined Title to be displayed in lazy mode
hasControls boolean false Shows/hides video controls in iframe
loop boolean false Enables video looping
allowFullScreen boolean true Enables/disables fullscreen button in iframe
start number undefined Sets starting video time (in seconds)
end number undefined Sets ending video time (in seconds)
styleClass string undefined External styling class
thumbQuality 'sd', 'medium', 'high', 'max' 'high' Lazy image quality

Vimeo Attributes

Property Type Default Description
videoId string undefined Video ID to be viewed
thumbQuality 'sd', 'medium', 'high', 'max' 'high' Lazy image quality
showTitle boolean false Enables/disables showing title in lazy mode
hasControls boolean false Shows/hides video controls in iframe
loop boolean false Enables video looping
isBackground boolean false Enables vimeo background mode, please refer to https://developer.vimeo.com/player/sdk/embed
styleClass string undefined External styling class

Contributing

Contributions are welcome. You can start by creating new Issue with proposal or bug report.


License

ngx-lite-video-v2 is an open source package released under the MIT license. See the LICENSE file for more information.

About

ngx-lite-video is an Angular package for lazy loading embedded YouTube and Vimeo videos, improving page speed and user experience.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 79.0%
  • SCSS 11.7%
  • HTML 9.3%
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy