Skip to content

Instantly share code, notes, and snippets.

View gkatsev's full-sized avatar

Gary Katsevman gkatsev

View GitHub Profile
videojs('foo', {
controlBar: {
children: ['playToggle',
'progressControl',
'volumeMenuButton',
'fullscreenToggle'],
volumeMenuButton: {
inline: false
}
}
------- Day changed to 09/25/15 -------
------- Day changed to 09/26/15 -------
09:06:00 -!- mehale_ is now known as mehale
------- Day changed to 09/27/15 -------
------- Day changed to 09/28/15 -------
04:26:58 -!- BostonGeorge2k is now known as Joh2k
------- Day changed to 09/29/15 -------
10:52:29 -!- Joh2k is now known as BostonGeorge
10:52:56 -!- BostonGeorge is now known as BostonGeorge2k
------- Day changed to 09/30/15 -------
var newStuff = arr.reduce(function(c, a, i, arr) {
if (doICareAboutIt(a)) {
c.push(i);
}
return c;
}, []);
@gkatsev
gkatsev / SassMeister-input-HTML.html
Created November 19, 2015 20:13
Generated by SassMeister.com.
<div class=foo></div>
@gkatsev
gkatsev / index.js
Created October 3, 2015 20:46
requirebin sketch
// hello world
var vjs = require("video.js")
var doc = require('global/document');
var domify = require('domify');
doc.head.appendChild(domify('<link href="http://vjs.zencdn.net/5.0.0/video-js.css" rel="stylesheet">'));
doc.body.appendChild(domify('<video id=vid class=video-js controls><source src=http://video-js.zencoder.com/oceans-clip.mp4 type=video/mp4></video>'));
var vid = vjs('vid');

Plugins

Plugins mostly have not changed from how they worked in Videojs 4.x. You still register and use them the same way. The only major change is that if you are instantiating a plugin inside the config of a player, this plugin will get run before the player is ready. This is so that if plugins are doing some UI work or adding themselves as children of the player they can do so early on. This means that plugins that require the player to be ready would need to handle that themselves or else not support instantiation via the player config. Ex:

videojs('my-video', {
 plugins: {
var async = require('async');
var swap = function(f) {
return function(callback) {
f(function(e, a) {
callback(a, e);
})
};
};
module.exports = function tryAll(tasks, callback) {
@gkatsev
gkatsev / index.js
Created August 30, 2015 22:24
requirebin sketch
// require() some stuff from npm (like you were using browserify)
// and then hit Run Code to run it on the right
var table = require('html-table-stream');
var concat = require('concat-stream');
var xhr = require('xhr');
xhr('http://crossorigin.me/http://www.transithistory.org/roster/', function(err, res, body) {
if (err) {
return document.body.innerHTML = err.message;
Steps to reproduce the problem:
1. create a page with a video element
2. include a subtitle or caption track
3. make sure that the track from above is not marked as `default`
What is the expected behavior?
the subtitles or captions should show up only if they are marked as default, or if the user selects them.
What is the actual behavior?
If the user has not previously selected any captions, the first caption in the caption list shows up, regardless or whether that track is in the user locale's or whether the default audio is in the user's locale or not.
@gkatsev
gkatsev / computedStyle.js
Created May 18, 2015 19:58
getComputedStyle shim
computedStyle = function(el, prop) {
if (typeof getComputedStyle === 'function') {
return getComputedStyle(el)[prop];
} else {
return el.currentStyle[prop];
}
}