okvideo

Fullscreen background videos for your webpages.

  • 所有者: okfocus/okvideo
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

OKVideo

OKVideo is a jQuery plugin that allows for YouTube or Vimeo videos to be used as full-screen backgrounds on webpages. OKVideo aims to be customizable while making some basic decisions about how the plugin should control video. When using OKVideo, all videos will be served from Vimeo or YouTube based on a number of variables like browser, device, bandwidth, etc.

OKVideo uses the new YouTube IFrame API which does not require any Flash objects to be present on your website. This means that mobile devices will play video served by OKVideo. Content from Vimeo is served in a similar manner, although sometimes their videos will still be served in Flash.

Tested and working in Safari 5.1+, Chrome, Firefox 3.6+, IE 8+, Mobile Safari, Chrome for iOS.

Usage

After including jQuery and the OKVideo plugin, instantiate OKVideo like so:


$(function(){
  $.okvideo({ video: '[:id]' }) // [:id] refers to a YouTube or Vimeo ID
});

OKVideo conveniently will accept and parse full urls from YouTube or Vimeo:


$(function(){
  $.okvideo({ video: '[:url]' }) // [:url] refers to a YouTube or Vimeo URL
});

Want a YouTube playlist? I got u.


$(function(){
  $.okvideo({ playlist: {
                list: '[:id]', // a YT playlist id
                suggestedQuality: '[:quality]'
              }
           });
});

OKVideo accepts a number of options. The below will embed a high definition video from YouTube with the audio set to 50% and log something to the console once the video has completed:


$(function(){
  $.okvideo({
      source: '[:url]',
      volume: 50,
      hd: true,
      onFinished: function(){
          console.log('finished video!')
      }
  });
});

You can also simply pass an id or url if no other options are desired:


$(function(){
  $.okvideo('[:url]') // [:url] refers to a YouTube or Vimeo URL
});

YouTube API Access

OKVideo gives you access to all of the YouTube player events. You can listen for all of the available player states: unstarted, ended, playing, paused, buffering, and cued. To listen for them simply pass OKVideo a function to the corresponding option noted below.

Options

Tests

OKFocus tests with Jasmine. Once you've cloned the repo run bundle and then rake jasmine to test the source.

主要指标

概览
名称与所有者okfocus/okvideo
主编程语言JavaScript
编程语言Ruby (语言数: 2)
平台
许可证MIT License
所有者活动
创建于2012-04-28 00:11:09
推送于2021-07-08 14:18:44
最后一次提交2015-02-16 12:47:22
发布数15
最新版本名称v2.3.3 (发布于 2014-07-10 18:16:15)
第一版名称1.0 (发布于 )
用户参与
星数365
关注者数16
派生数77
提交数71
已启用问题?
问题数0
打开的问题数0
拉请求数5
打开的拉请求数5
关闭的拉请求数0
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?