GithubHelp home page GithubHelp logo

svelte-scroll-video's Introduction

Svelte Scroll Video

A component to play a video by scrolling the page

Installation

$ npm install @macfja/svelte-scroll-video
# or
$ yarn add @macfja/svelte-scroll-video
# or
$ pnpm add @macfja/svelte-scroll-video

Usage

<script>
  import ScrollVideo from "@macfja/svelte-scroll-video";
</script>

<p>...</p>
<ScrollVideo src="https://example.com/my-video.webm" />
<p>...</p>

Example on REPL

Configurations

Option Type Default Description
pixelPerSec Prop 1000 Number of pixel to scroll for 1 sec of video
on:playing Event N/A This event is dispatched every times the playing status changes (event.detail contain true if the video is progressing)
on:position Event N/A This event is dispatched every times the playback is updated (event.detail contain the number of seconds elapsed)
--video-background CSS Property transparent The color behind the video
--video-height CSS Property 100vh The height of the video
any value Prop empty All attribute you want to pass to the <video> element
any value Slot empty Any data that you want to be a child of the <video> element
<ScrollVideo
    pixelPerSec="250"
    on:playing={e => console.log('The video is ' + (e.detail?'playing':'in pause')}
    on:position={e => console.log('The video is at its '+(e.detail)+' seconds')}
    --video-background="black"
    --video-height="90vh"
    src="https://example.com/my-video.webm"
>
    <track src="https://example.com/captions.srt" kind="captions" />
</ScrollVideo>

Examples

See Examples.md

Contributing

Contributions are welcome. Please open up an issue or create PR if you would like to help out.

Read more in the Contributing file

License

The MIT License (MIT). Please see License File for more information.

svelte-scroll-video's People

Contributors

macfja avatar

Stargazers

Santhosh Kumar K avatar Le Ngo Duc Anh avatar Niranjan Anandkumar avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.