Coder Social home page Coder Social logo

likang19870916 / imgplay Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nterms/imgplay

0.0 1.0 0.0 29 KB

Image sequence player with streaming and dynamic loading. jQuery plugin.

License: MIT License

JavaScript 86.76% HTML 7.85% CSS 5.40%

imgplay's Introduction

imgplay

Image sequence player jQuery plugin with streaming and dynamic loading.

Usage

Add styles inside <head> tag.

<link rel="stylesheet" href="path/to/imgplay/jquery.imgplay.css" />

Add plugin at the bottom of the page after jQuery

<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="path/to/imgplay/jquery.imgplay.min.js"></script>

List the set of images inside a container <div> so that payer can pick them and play.

<div id="imageplayer" class="imageplayer">
    <img src="image1.jpg" />
    <img src="image2.jpg" />
    <img src="image3.jpg" />
    <img src="image4.jpg" />
    <img src="image5.jpg" />
    <img data-src="image6.jpg" />
    <img data-src="image7.jpg" />
    <img data-src="image8.jpg" />
    <img data-src="image9.jpg" />
    <img data-src="image10.jpg" />
</div>

Notice that only from image1.jpg to image5.jpg are loaded when the page is loaded and other images have data-src attribute instead of the src attribute. This makes the player dynamically load these images while it plays images till image5.jpg.

Now invoke the player.

<script type="text/javascript">
    (function($) {
        $(document).ready(function() {
            $('#imageplayer').imgplay({rate: 2}); // start imgplay
        });
    })(jQuery);
</script>

Options

Following options are currently available for configuring the plugin.

  • rate - Number of frames per second. Default is 1.
  • controls - Whether to show player controls. Default is true.

Methods

Following methods can be called on the player object to programatically control it's behaviour.

  • play() - Play the image sequence.
  • pause() - Pause the player.
  • stop() - Stop the player.
  • rewind(frames) - Jump number of frames backward.
  • forward(frames) - Jump number of frames forward.
  • fastRewind(rate) - Play backword at given rate.
  • fastForward(rate) - Play forword at given rate.
  • previousFrame() - Pause and jump to the previous frame.
  • nextFrame() - Pause and jump to the next frame.
  • toFrame(i) - Jump to the frame number i.
  • fullscreen() - Toggle fullscreen mode.

All the methods are simply callable through the data property of the container element after initialisation.

$('#imageplayer').data('imgplay').play();

Contribute

  • If you think the idea of imgplay is intersting just let me know That surely will be a push forward.
  • If you find a bug or a way we can improve imgplay, just open a new issue.
  • If you have fixed something or added new feature, just send a pull request.

License

MIT License. Please see LICENSE for license details.

imgplay's People

Contributors

lukemurray avatar nterms avatar saranga-kraken avatar

Watchers

 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.