GithubHelp home page GithubHelp logo

gka / canvid Goto Github PK

View Code? Open in Web Editor NEW
1.1K 1.1K 71.0 5.37 MB

tiny js library for playing video on canvas elements (without audio)

Home Page: https://gka.github.io/canvid

License: ISC License

JavaScript 100.00%

canvid's People

Contributors

gka avatar kennynaoh avatar moklick avatar ryancurtin avatar thomascharbit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

canvid's Issues

Integrate a canvid within a canvas

Hi, thanks for canvid, it's a great idea. I have very little experience of canvas and I was wondering if it was possible to integrate a canvid video within the wider "context" (in the ordinary sense) of a canvas element, so the canvas could contain other stuff along with the canvid(s).

Audio sync

If you'd add a method / property which returns current frame / time, it can be extended to sync with audio in the background.

Infinite loop ?

Is there a way to make infinite loop ? Configuring loop to -1, doesn't seem to work.

Support for Dom element as a selector

So I can do this:
var canvidControl = canvid({
selector : document.querySelector(".myelement"),
videos: {
clip1: { src: 'clip1.jpg', frames: 38, cols: 6 },
clip2: { src: 'clip2.jpg', frames: 43, cols: 6, loops: 3 }
},
width: 500,
height: 400,
loaded: function() {
canvidControl.play('clip1');
// reverse playback
// canvidControl.play('clip1', true);
}
});

I have multiple videos on page and all of them have same selectors.

Is there a way to load clip on demand for saving web flow data?

The video clips like:

{
  clip00: {src: 'static/video/00.jpg', frames: 24, cols: 6, fps: 12},
  clip01: {src: 'static/video/01.jpg', frames: 24, cols: 6, fps: 12},
  clip02: {src: 'static/video/02.jpg', frames: 24, cols: 6, fps: 12},
  clip04: {src: 'static/video/04.jpg', frames: 24, cols: 6, fps: 12},
  clip05: {src: 'static/video/05.jpg', frames: 24, cols: 6, fps: 12},
}

I visit the website and the canvid will switch the clip to a specific one in some condition. Is there a way for saving the transferred network data if some clips have no necessary being played?
Or I have to get the condition first then create the canvid dynamically?

Broken in Chrome 46 for Android

I've tried it on a Android 4.3 device with Chrome 46, and the canvas ends up larger than the frame. I don't see a video, but rather, a scrolling fly by over the sprite sheet.

Janky when looping through sprites

There seems to be a jank between each sprite when doing this

var canvidControl = canvid({
    selector : '.video',
    videos: {
        clip1: { src: 'clip-1.min.jpg', frames: 32, cols: 6, fps: 30, loops: 1, onEnd: function(){
          canvidControl.play('clip2');
        }},
        clip2: { src: 'clip-2.min.jpg', frames: 32, cols: 6, fps: 30, loops: 1, onEnd: function(){
          canvidControl.play('clip3');
        }},
        clip3: { src: 'clip-3.min.jpg', frames: 32, cols: 6, fps: 30, loops: 1},
    },
    width: 640,
    height: 360,
    loaded: function() {
        canvidControl.play('clip1');
    }
});

about android

it can run pc and ios ,but in android ,it can't run.

why ?

Control video through scrolling

Hey,

thanks for this library. Just playing around because I'm searching right now for a solution for an animation of mine. Have you ever tried to control the video through scrolling? I'm thinking of a like parallax effect. The video "plays" while scrolling. Back or forward. Do you think this is possible?

Greets

Broken in Chrome 48 for Android

The image playback has an issue with the origin position.
Tested in Chrome version 48 on Android 6.0. Maybe a Chrome issue.

Pass more styles to canvid beyond width and height

I could be wrong but there doesn't seem to be a way to do this right now. As a workaround, in my own CSS, I added the .canvid class and added the extra styling that I wanted, but I'd prefer to be able to pass through the canvid creation function instead.

Compress sprites

Just a quick tip you maybe could include in your docs.

Compress sprites

For a great ~85% reduction in filesize install jpeg-recompress

On a mac simply brew install jpeg-archive
and than jpeg-recompress --quality high clip1.jpg clip1.min.jpg

issue on Android with multiple sprites playing on a page

Facing issue on Android. When there is more than one canvid playing on the page, the sprite > 400 KB makes other sprites frame load slower.

Example: have 2 canvids less than 400kb loading fine on page. When I add the third one with size > 400KB. All three players become very slow. Kind of loading 1 frame per sec.

While if the sprite > 400KB is played alone on page, it works fine... But with other sprites it is causing issue.

I am aware there is a known issue on devices for bigger sprites.. But the one I am referring to is just 400 KB and has 102 frames. And there is no issue when the sprite is the only sprite loaded on page.

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.