All Projects → BKWLD → vue-visual

BKWLD / vue-visual

Licence: MIT license
Vue 2 image and video loader supporting lazy loading, background videos, fixed aspect ratios, low rez poster images, transitions, loaders, slotted content and more.

Programming Languages

javascript
184084 projects - #8 most used programming language
coffeescript
4710 projects
Vue
7211 projects
CSS
56736 projects

Projects that are alternatives of or similar to vue-visual

Vanilla Lazyload
LazyLoad is a lightweight, flexible script that speeds up your website by deferring the loading of your below-the-fold images, backgrounds, videos, iframes and scripts to when they will enter the viewport. Written in plain "vanilla" JavaScript, it leverages IntersectionObserver, supports responsive images and enables native lazy loading.
Stars: ✭ 6,596 (+11678.57%)
Mutual labels:  lazy-loading, srcset, intersectionobserver
Abmediaview
Media view which subclasses UIImageView, and can display & load images, videos, GIFs, and audio and from the web, and has functionality to minimize from fullscreen, as well as show GIF previews for videos.
Stars: ✭ 79 (+41.07%)
Mutual labels:  video-player, lazy-loading
Skeleton Elements
Skeleton elements - UI for improved perceived performance
Stars: ✭ 27 (-51.79%)
Mutual labels:  loader, lazy-loading
React Intersection Observer
React implementation of the Intersection Observer API to tell you when an element enters or leaves the viewport.
Stars: ✭ 2,689 (+4701.79%)
Mutual labels:  lazy-loading, intersectionobserver
Vue Content Placeholders
Composable components for rendering fake (progressive) content like facebook in vue
Stars: ✭ 1,547 (+2662.5%)
Mutual labels:  loader, lazy-loading
Ember Content Placeholders
Composable components for rendering fake (progressive) content like facebook
Stars: ✭ 121 (+116.07%)
Mutual labels:  loader, lazy-loading
Giraffeplayer2
out of the box android video player(support lazy load, ListView/RecyclerView and hight performance)
Stars: ✭ 344 (+514.29%)
Mutual labels:  video-player, lazy-loading
webpack-image-srcset-loader
Generate srcset string from image
Stars: ✭ 28 (-50%)
Mutual labels:  loader, srcset
fast-relay-pagination
Improve relay pagination performance with find and limit
Stars: ✭ 18 (-67.86%)
Mutual labels:  lazy-loading
nunjucks-loader
Webpack loader for Nunjucks templates
Stars: ✭ 20 (-64.29%)
Mutual labels:  loader
QtDemos
This is a demo about Qt5, including Qt Custom Widget, Qt Multithreaded Downloader, QML Video Player(using OpenGL, FFmpeg and SDL2)
Stars: ✭ 18 (-67.86%)
Mutual labels:  video-player
react-intl-loader
Async react-intl locale data loader for webpack
Stars: ✭ 46 (-17.86%)
Mutual labels:  loader
faker
A kotlin extension to load images asynchronously on android
Stars: ✭ 58 (+3.57%)
Mutual labels:  loader
IQPlayer
Simple video player with subtitle for flutter.
Stars: ✭ 16 (-71.43%)
Mutual labels:  video-player
tutorials-hg1
These tutorials demonstrate the usage of the Harfang API
Stars: ✭ 12 (-78.57%)
Mutual labels:  video-player
nani
Crunchyroll without the bloat
Stars: ✭ 63 (+12.5%)
Mutual labels:  video-player
favicon-canvas-loader
Create and display a circular loading <canvas> animation as a webpage favicon.
Stars: ✭ 83 (+48.21%)
Mutual labels:  loader
CsharpVoxReader
A generic C# reader for MagicaVoxel's vox file format
Stars: ✭ 15 (-73.21%)
Mutual labels:  loader
rollup-loader
Rollup does what it can do, and let Webpack finish the job.
Stars: ✭ 86 (+53.57%)
Mutual labels:  loader
vue-tiny-lazyload-img
🐌 A small size Vue.js directive for lazy loading images using IntersectionObserver API
Stars: ✭ 91 (+62.5%)
Mutual labels:  lazy-loading

Vue Visual npm

Vue 2 image and video loader supporting lazy loading. Visual 2.x is a simplification of Version 1.x with a greater reliance on modern browser features (IntersectionObserver, object-fit, srcset, sizes, etc).

Examples at https://bkwld.github.io/vue-visual.

Installation

  1. Install the package: npm install --save vue-visual or yarn add vue-visual
  2. Register the component:
    import Vue from 'vue'
    import Visual from 'vue-visual'
    Vue.component('visual', Visual)
    import 'vue-visual/index.css'
  3. These polyfills are recommended for older browsers:

Usage

See the Storybook.

Props

A list of the component properties that may be set on the Visual component.

Assets

  • image (string) : The URL of an image to load.

  • srcset (string) : An img srcset, used in addition to the image. Both are recommended.

  • webp-srcset (string) : A srcset that will be added to a source inside of a picture element with a type of image/webp.

  • video (string|array) : A video that is loaded after the image is loaded if the device supports video. If a string, should be the URL to a source video. If an array, a list of video URLs that will be added as difference <source>s.

Size

  • width (number|string) : This width will be applied to the asset element. If a number, it's assumed to be a px value.

  • height (number|string) : See width

  • max-width (number|string) : This value will be applied to the asset element as the css max-width. If a number, it's assumed to be a px value.

  • sizes (string) : Specify the img sizes attribute.

  • aspect (number) : Force the Visual to a specific aspect ratio. This works by making the asset position:absolute and then using an inner div with a padding-top set to a percentage.

  • expand (boolean) : Make the Visual fill it's container via CSS using absolute positioning.

Style

  • object-fit (string) - Default cover. Like the CSS property.

  • object-position (string) - Default center center. Like the CSS property.

  • align (string) - Default center middle.. Used in conjunction with slots to position the slot content. May be any combination of one horizontal (left, center, right) and one vertical (top, middle, bottom) choice, space-delimited.

Loading

  • autoload (boolean) - Default: true. If true, assets are loaded immediately unless lazyload.

  • lazyload (boolean) - Waits until the Visual enters the viewport to trigger loading. Overrides, autoload.

  • intersection-options (object) - IntersectionObserver options. Used with lazyload and autopause.

  • placeholder-color - Sets a background color behind the assets. Most useful in conjunction with an aspect value.

  • transition (string, boolean) - Default: 'vv-fade'. A Vue transition name that is applied when an asset is loaded. Set to an empty string to immediately render assets rather than waiting for loading.

Video

  • autoplay (boolean) - If true, begins playing immediately.

  • autopause (boolean) - If true, begins playing when the Visual enters the viewport and stops when it leaves. Overrides autoplay.

  • loop (boolean) - Sets <video> loop

  • muted (boolean) - Sets <video> muted

  • controls (boolean) - Sets <video> controls

Accessibility

  • alt (string) - Sets the alt attribute or aria-label value, depending on context.

Slots

  • default: Markup is added after the assets and before the loader
  • image-source: Adds <source> tags to the <picture> element.
  • video-source: Adds <source> tags to the <video> element.

Methods

  • load() - Manually initiate loading.
  • play() - Tell video to play.
  • pause() - Tell video to pause.
  • restart() - Tell video to restart playback from beginning.

Events

  • loaded:image - Image asset has finished loading
  • loaded:video - Video asset has finished loading
  • loaded - All assets hvae loaded

Contributing

  • Boot up the Storybook with yarn storybook and use that as your HMR friendly dev environment
  • Use npm version ... to build, tag, and update the poblished storybook

Changes from 1.x

  • Dropped props:
    • poster
    • fallback
    • per-asset variants for load, etc
  • Prop changes
    • background object-fit
    • background-position object-position
    • fill expand
  • Not testing for video support on device
  • Video playing state not stored in Vue state
  • Image and video loaded simultenously, not in series
  • Removed setDefaults for setting default options. See custom-defaults for an example of how to implement this functionality using a functional component.

migrate-1.x.coffee shows an example of a functional component that migrates the old API to the new API.

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].