• Stars
    star
    397
  • Rank 108,561 (Top 3 %)
  • Language
    JavaScript
  • Created about 11 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A video player without video files, just JSON. Based on 'images frames' thought to mobile devices!

#Frame Player

A video player without video files, just JSON. Based on "images frames" thought to mobile devices!

##The Problem The problem of today's HTML5 video is that it can't be played in-line on an HTML page on mobile devices. The way the handheld devices handle it is they open the video in a native player which takes over the page itself, making it impossible to implement any interaction while the video is playing. Also, you can't play two videos at the same time.

##The Solution Create a player instead of playing video files, show a sequence of images at a certain rate.

##Instalation

  • Download the latest version of Frame Player.

  • OR Use bower to install Frame Player

bower install frame-player
  • Put the script and the style on your page
    <link rel="stylesheet" href="path-to/frameplayer.css">
    <script src="path-to/frameplayer.js"></script>

##Usage

  • Insert this HTML code on any part of your page and set the data-src attribute for your JSON video file
    <div id="my-player" class="frameplayer" data-vidsrc="videos/video.json"></div>
  • Set the options
var options = ({
    'rate': 30,
    'controls': false,
    'autoplay': true,
    'backwards': false,
    'startFrame': 10,
    'width': '640px',
    'height': '390px',
    // 'radius': '50%'
});
  • Init the player
var player = new FramePlayer('my-player', options);
	player.play();

Methods

Method Parameters Returns Description
play() None. Nothing. Start playing the video.
pause() None. Nothing. Pause the current video.
resume() None. Nothing. Play the current video from the moment it was paused.
gotoFrame() Integer. Nothing. Jumps to a specific frame of the video.

##Generating the JSON Video File (ffmpeg lib must be installed)

- Option 1: Node.js - single command

    ```bash
    cd converter/nodejs_one
    node app.js path/to/video/file path/to/video.json/file startTime endTime
    ```

- Option 2: Node.js

    - Use ffmpeg to generate the frames from a video file:

    ```bash
    ffmpeg -i video.mp4 -an -f image2 "%d.jpg"
    ```

    - Convert all frames on a single JSON file

	```bash
	cd converter/nodejs
	node app.js frameStart frameEnd folder/to/imgs/ json/video.json
	```

- Option 3: PHP

    - Use ffmpeg to generate the frames from a video file:

    ```bash
    ffmpeg -i video.mp4 -an -f image2 "%d.jpg"
    ```

	```bash
	cd converter/php
	php to_data_uri.php frameStart frameEnd folder/to/imgs/ json/video.json
	```

Development

In order to run it locally you'll need to fetch some dependencies and a basic setup.

  1. Install Gulp:

    $ [sudo] npm install --global gulp
  2. Install local dependencies:

    $ npm install
  3. To test your project, start the development server (using your prefered server) and open http://localhost:8000.

    $ python -m SimpleHTTPServer 8080
  4. To build the distribution files before releasing a new version.

    $ gulp build
  5. Send everything to gh-pages branch.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

Vagner Santana | --- | --- | --- | --- | --- | --- | --- Vagner Santana
@vagnervjs|

License

More Repositories

1

grunt-boilerplate

A base for start and deploy a project using Grunt: The JavaScript Task Runner
JavaScript
53
star
2

social-signin-btns

Social Sign In Buttons in CSS
HTML
45
star
3

player.io

A real-time media player thats run on your browser and you controls in your smartphone. Made with node.js, socket.io and File Access API.
JavaScript
27
star
4

voice-navigation

Navigate in Google Maps using voice (or keyboard, ok)
JavaScript
8
star
5

Web-Messaging-API

Simple exemple using this HTML5 communication API
5
star
6

ipod-circle-menu

Simplistic menu in the style of iPod only made with CSS.
5
star
7

simple-restify-api

A micro API using nodejs, restify and mongoose
JavaScript
3
star
8

simple-grid

A simple less grid
CSS
3
star
9

php-converter-ffmpeg

Converting media files using ffmpeg in php
PHP
3
star
10

Zepto.js-draggable

A demo using zepto.js to drag images in mobile devices
JavaScript
3
star
11

intranet.js

A JavaScript library to detect if a client is in a particular intranet
JavaScript
2
star
12

react-playground

React playground
JavaScript
2
star
13

cssgram

A PhoneGap project. Take a photo or video and edit with CSS3.
JavaScript
1
star
14

t_proj

A simple social network made with Backbone.js, Node.js and MongoDB
JavaScript
1
star
15

simple-webrtc

A simple test using the lib Simple Wrtc
JavaScript
1
star
16

animoby-embed-element

AniMoby Custom element
1
star
17

8-puzzle-js

8 Puzzle Game in JavaScript
CSS
1
star
18

chrome_devtools_monokai_style

The Monokai Style for your Chrome Devtools
CSS
1
star
19

tcc

A Node.js API for my TCC at Unesp using restify and mongoose
PHP
1
star
20

socket.io.test

An initial project using socket.io
JavaScript
1
star
21

smooth-scrolling-steps

Smooth scrolling in steps
JavaScript
1
star
22

functional-javascript-workshop-solved

Functional Javascript Workshop problems solved
JavaScript
1
star
23

compass-sprite-boilerplate

A base project for generate your sprite using Compass
Ruby
1
star
24

redux-app-sample

JavaScript
1
star
25

fille_access_player_html5

1
star
26

imgoptim-tasks

Tasks to: Optimize images / Create Sprites
JavaScript
1
star
27

dotfiles

❤ ~/
Python
1
star
28

Slides

HTML5 Slides / Presentation
JavaScript
1
star