Giter VIP home page Giter VIP logo

vide's Introduction

NPM version Bower version Travis Vide

No longer actively maintained. I am not interested to maintain jQuery plugins anymore. If you have some fixes, feel free to make PR.

Easy as hell jQuery plugin for video backgrounds.

Notes

  • All modern desktop browsers are supported.
  • IE9+
  • iOS plays video from a browser only in the native player. So video for iOS is disabled, only fullscreen poster will be used.
  • Some android devices play video, some not — go figure. So video for android is disabled, only fullscreen poster will be used.

Instructions

Download it from GitHub or via Bower: bower install vide

Include plugin: <script src="js/jquery.vide.min.js"></script>

Prepare your video in several formats like '.webm', '.mp4' for cross browser compatibility, also add a poster with .jpg, .png or .gif extension:

path/
├── to/
│   ├── video.mp4
│   ├── video.ogv
│   ├── video.webm
│   └── video.jpg

Add data-vide-bg attribute with a path to the video and poster without extension, video and poster must have the same name. Add data-vide-options to pass vide options, if you need it. By default video is muted, looped and starts automatically.

<div style="width: 1000px; height: 500px;"
  data-vide-bg="path/to/video" data-vide-options="loop: false, muted: false, position: 0% 0%">
</div>

Also you can set extended path:

<div style="width: 1000px; height: 500px;"
  data-vide-bg="mp4: path/to/video1, webm: path/to/video2, ogv: path/to/video3, poster: path/to/poster"
  data-vide-options="posterType: jpg, loop: false, muted: false, position: 0% 0%">
</div>

In some situations it can be helpful to initialize it with JS because Vide doesn't have mutation observers:

$('#myBlock').vide('path/to/video');
$('#myBlock').vide('path/to/video', {
...options...
});
$('#myBlock').vide({
  mp4: path/to/video1,
  webm: path/to/video2,
  ogv: path/to/video3,
  poster: path/to/poster
}, {
...options...
});
$('#myBlock').vide('extended path as a string', 'options as a string');

Easy as hell.

Options

Below is a complete list of options and matching default values:

{
  volume: 1,
  playbackRate: 1,
  muted: true,
  loop: true,
  autoplay: true,
  position: '50% 50%', // Similar to the CSS `background-position` property.
  posterType: 'detect', // Poster image type. "detect" — auto-detection; "none" — no poster; "jpg", "png", "gif",... - extensions.
  resizing: true, // Auto-resizing, read: https://github.com/VodkaBears/Vide#resizing
  bgColor: 'transparent', // Allow custom background-color for Vide div,
  className: '' // Add custom CSS class to Vide div
}

Methods

Below is a complete list of methods:

// Get instance of the plugin
var instance = $('#yourElement').data('vide');

// Get video element of the background. Do what you want.
instance.getVideoObject();

// Resize video background.
// It calls automatically, if window resize (or element, if you will use something like https://github.com/cowboy/jquery-resize).
instance.resize();

// Destroy plugin instance
instance.destroy();

Resizing

The Vide plugin resizes if the window resizes. If you will use something like https://github.com/cowboy/jquery-resize, it will resize automatically when the container resizes. Or simply use resize() method whenever you need.

Set the resizing option to false to disable auto-resizing.

Encoding video

http://diveintohtml5.info/video.html#miro

Meteor

Install

meteor add vodkabears:vide

Usage

Because of how meteor renders templates reactively you will need to initialize manually for the templates you want to use vide in.

Template.templateName.onRendered(function() {
  this.$('#elementName').vide('fileNameWithoutExtension');
});

Meteor integration by zimme.

Ruby Gem

Vider by Islam Wazery.

License

The MIT License (MIT)

Copyright (c) 2015 Ilya Makarov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

vide's People

Contributors

alexbonhomme avatar eykamp avatar huitsing avatar jamesmcmahon avatar jaybizzle avatar kkirsche avatar pthrasher avatar shawnbutts avatar stanback avatar vodkabears avatar zimme 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  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

vide's Issues

IOS video

i saw at the notes that video is iOS is disabled, is it possible to enable it ?

Push still image to IE8 and below

The Issue
Old versions of IE (8 and below) error on the video script

Steps to reproduce

  1. Add video to an element
  2. Open in IE 8 (or emulated, see notes)
  3. Site-breaking error occurs

What should happen
Auto-detect browser agent and fall back to a still image in unsupported versions.

Additional Notes
I was about to write a conditional into my jQuery to avoid throwing this error but it should really be part of the base script. IE11 finally includes an emulation mode for older versions (F12 > sidebar > last item in scroll) so it should be fairly straightforward to produce.

Toggle Audio

Hello,

I am trying to create an audio toggle button for my background video using your plugin. Using methods such as

.prop('muted', true)

and

.setVolume(0);

and

.mute();

via an onclick function but no joy. Any suggestions to help me along the way?

Tablet Compability

When i check on my ipad and Nexus, it is not showing the video background?

Does it only work for desktop version? or is there a way to tweak the code to compatible with tablet user.

thanks :)

findPoster throwing 'file not found' on all image extensions that aren't available.

Typically you'd only need one type of fallback image, so you'd never need to load multiple formats (plus it's unlikely anyone would save out multiple background formats for the same poster image).

Ideally you'd want to pull whatever poster image source format is specified and load only that one, regardless of the extension, so Vide doesn't try to find and load images that don't exist.

jQuery undefined is not a function on line 174

For some reason, and one I can't figure out, I'm getting a 'jquery.vide.js:174 Uncaught TypeError: undefined is not a function' error with this plug in. Any ideas? I'm initializing it like this:
<div id="video" data-vide-bg="mp4: Video/IndexVideo, webm: Video/IndexVideo, ogv: Video/IndexVideo, poster: Video/IndexVideo" data-vide-options="position: 50% 0%">
and
<script> $('#video').vide({ playbackRate:1, muted:true, loop:true, autoplay:true, posterType:"detect", resizing:true }); var instance = $('#video').data('vide'); $(window).resize(function(){ instance.resize(); }); </script>

An Idea

Is there away that maybe you could add the ability to select between different videos maybe like 4 or 5 different videos

Path Issue in WordPress

HI,

I am using this plugin in a template which is going to be a WordPress Theme. Now the issue is WordPress don't have folders and your plugin didn't work with it.

Thanks

Browser Compatibility - Safari to be Specific

Works great on Opera, FireFox, Chrome and IE (latest versions) but doesn't work on Safari at all. What video format would solve the issue? I have mp4, webm, and ogg file formats. What do I need to add to get it working on safari?

Great tool by the way!

play/pause button?

I dont see any way with this plugin to make a play/pause button.

Any documentation on how to implement that?

Background fallback image not displaying on iOS

The title says it all. The screen is blank and the fallback image doesn't display when viewing a page with the plugin on iOS when Vide is targeting a div. I pulled up your demo on my iPhone and the fallback image is working fine on the body. Any ideas?

How to detect video load event?

Hello!

Have a small question about this plugin - how I can detect video onload event(or canplaythrough, or just when video starts playing), for use in page preloader to avoid white flashes, delays and etc.

Background Cover

Implementation of this plugin is great. However, the background does not scale or cover correctly. If a page is larger than the aspect ratio o the video, the page will break and a gap will form between the video and content. Any ideas would be helpful.

Make "posterType" optional please.

Hi and thanks for this nice plugin. I was wondering if there was a chance to see something like this: posterType: "none" in the future? I'm using Vide within a WP theme and I want to make it easier for the user to select a BG-img and a video. The issue here is that both need the same name which makes it more of a pain for the user to set up. Thanks.

play/pause button

Excellent script!
But I'm trying to add a play / pause button, is it possible?

absolute url support?

working great, except we'd like to load the video from amazon cloudfront and when I provide an absolute URL the plugin gets super confused by the http:// at the beginning...

Video not auto playing

Hi there,

Great plugin, but I can't get the video to auto play. I'm using the following jquery:

                $('#Home-Slide-Video-1').vide({
                    mp4: 'http://tendril.ca.s3-website-us-east-1.amazonaws.com/Assets/Media/Tendril-Splash-Video.mp4',
                    webm: 'http://tendril.ca.s3-website-us-east-1.amazonaws.com/Assets/Media/Tendril-Splash-Video.webm',
                    ogv: 'http://tendril.ca.s3-website-us-east-1.amazonaws.com/Assets/Media/Tendril-Splash-Video.ogv',
                    poster: ''
                }, {
                    volume: 1,
                    playbackRate: 1,
                    muted: true,
                    loop: true,
                    autoplay: true,
                    position: '50% 50%',
                    //posterType: 'detect',
                    resizing: true
                });

                var video = $('#Home-Slide-Video-1').data('vide');
                var videoObject = video.getVideoObject();
                //videoObject.resize();
                //videoObject.play();

                console.log(videoObject);
</script>

With the following HTML:

<div id="Home-Slide-Video-1" class="Home-Slide-Media"></div>

iOS - refresh still image

Just because I know this will come up within 30 seconds of demo.

Is there an "easy as hell" solution for changing the still image every few seconds on the mobile version? Even though it's almost 2015 and we generally hate sliders, that one sliver of the old tech can be useful for simulating this particular experience in still frames.

Just wondered if you built it in.

Play/Pause/Stop

Is there a way to Pause/Stop/Play the video on a button click via jQuery?
Any instructions?
Thx

Internet Explorer 8 Error

Internet Explorer 8 sends Error and quites complete. Could you provide a fix here, so IE8 would show the jpg File which is provided as Background-Image for that div.

Many of our Clients still using that shitty browser or have to use it.

-Domtaholic

URL's with port numbers return an error

This doesn't affect anyone that would be deploying Vide on a live server, but for people that are developing locally, jQuery throws the following error when the resource is on a URL with a port number. (ie http://localhost:4567)

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:4567/[object%20Object].gif
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:4567/[object%20Object].jpg
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:4567/[object%20Object].png
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:4567/[object%20Object].jpeg
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:4567/[object%20Object].mp4
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:4567/[object%20Object].ogv
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:4567/[object%20Object].webm

Pausing video

So I am using this plug-in for a site, and it works great. I have a few videos embedded in modal boxes and I am looking to pause vide while the modal is open. Is there a function that pauses vide that I can implement when the modal box opens?

Question.. Resizing based on width

I've tried following your doc's but I'm still struggling with how to get the video to resize to the width of the containing div as it seem's height is the default method.

Please can you point me in the right directions

Loop not working

Hi,

Great plugin, only problem I have is that my video is not looping. I added data-video-options attribute and set loop to true, but still no loop. Did I forget something in the code?

Regards,
Ali

background-color cannot be specified

Perhaps its blatantly obvious, but I think It should be noted somewhere in your docs that setting the background color property on the div which contains the video will prevent the video from being displayed :)

Doesn't Work - Would Never Work

None of the sample code supplied works 👍
The path you are trying to load jquery from does not exist in the project (404 error)

Also you have included JQuery twice - once in HTML, the other you are adding via Javascript - why I have no idea.

Honestly, why bother supplying untested, non working code for a project that would never do what you said it did anyway?!

White flash before video starts

Hi,
I love this plug in! When my page loads I see a quick white flash before the video starts. It appears that the poster is showing, and then the background is white, then the video starts.

Do you have any suggestions as to what might be causing this or how to stop it from happening? We are using jquery.1.11.1.min.js and the latest jquery.vide.js

Sample: http://fok.getinfopage.com/index.html
body tag:

I also see it at http://vodkabears.github.io/vide/ (though the background is dark gray rather than white) so perhaps it cannot be avoided.

Thanks,
Frederick

use vimeo or youtube

is there a possibility to use videos from vimeo or youtube with this plugin?

Thanks!

Start/End time

Hi, is there a way to set the start and/or end playback time?

Position in Firefox 15 (transform)

in Firefox 15 or older transform is not supported without vendor prefix. the video is located in wrong position even on your demo page. Solution: just add '-moz-transform': 'translate(-' + position.x + ', -' + position.y + ')',

Videos must have a relative path?

I notice that if I try to reference a video with an absolute URL, it seems like it won't load. Is there something I'm doing wrong?

Full width and height within a slider

I'm sure I'm doing something wrong, though I wanted to ask about it. I'm trying to add the video within Slick slider http://kenwheeler.github.io/slick/. It's working fine except I'm stuck on getting it to properly fill the height of the div - likely because the height dimension is set as fixed. Tried adding fitvids.js to see if that would work better but still stuck on getting it to resize proportionally with the slider in different screen resolutions. Here's an example I'm referring to: http://look.wpengine.com/.

And I'm not sure where to add the poster image?

Thanks!
Justin

Question about network activity

Vide is super easy to set up. Thanks for that. I was looking at my "Network" tab in the developer tools in Chrome and I noticed that looping a video was causing the constant network traffic at the end of each loop. It's wasn't caching the video like I expected. Can you shed any light on why this might be happening?

Internet Explorer Issue

After the still image is loaded, it will turn into black color background and wait till the video is playing. But for other browsers, its working fine.

The video i'm using is around 10.9mb. Should i use a smaller size to eliminate the black color background?

Vide destroy() method throwing error in iOS 7

The vide destroy() method throws an error when invoked dynamically on mobile Safari iOS7:

TypeError: 'undefined' is not an object (evaluating 'this.video.unbind')

...and references line 276:

this.video.unbind(pluginName);

Commenting this out solves the issue, so I'm not sure if it's a syntax error somewhere or if it can just be removed altogether.

PS -- This is the only reliable video background plugin out there. Nice job!

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.