Skip to content

Instantly share code, notes, and snippets.

View mmcc's full-sized avatar
📺
Movin vidja bits

Matthew McClure mmcc

📺
Movin vidja bits
View GitHub Profile
@mmcc
mmcc / request.json
Last active December 17, 2015 16:38
Live CDN example
{
"live_stream": true,
"outputs": [
{
"label": "rtmp300",
"size": "480x270",
"video_bitrate": 300,
"live_stream": true
},
{
@mmcc
mmcc / user-preferences.sublime
Created August 15, 2013 05:04
sublime preferences
{
"color_scheme": "Packages/Base16/base16-eighties.dark.tmTheme",
"detect_indentation": true,
"draw_white_space": "selection",
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
".DS_Store",
".tags*",
"*.pyc",
@mmcc
mmcc / progress.js
Created November 29, 2013 15:05
Bootstrap Zencoder progress
var jobId = 12345;
var jobProgress = 0;
function poll() {
setTimeout(function() {
$.ajax({
url: 'https://app.zencoder.com/api/v2/jobs/' + jobId + '/progress',
type: 'GET',
headers: { "Zencoder-Api-Key": 'ZENCODER READ ONLY API KEY' },
//dataType: 'json',
@mmcc
mmcc / live-cdn.js
Last active January 2, 2016 14:48
Live stream to Zencoder CDN. Requires cdn feature flag to be enabled on the account.
// require Zencoder integration library
var zencoder = require('zencoder')()
, colors = require('colors');
console.log('Sending API request...'.blue);
// send a request
zencoder.Job.create({
"live_stream": true,
"event_length": 600,
@mmcc
mmcc / vjs.less
Created January 21, 2014 22:55
VJS optional slider handles
/*!
Video.js Default Styles (http://videojs.com)
Version GENERATED_AT_BUILD
Create your own skin at http://designer.videojs.com
*/
// To customize the player skin, change the values of the variables or edit the
// CSS below.
// (This file uses LESS. Learn more at http://lesscss.org/)
@mmcc
mmcc / bc-play-converter.js
Created January 24, 2014 21:35
Convert some BC Play videos.
var zc = require('zencoder')()
, request = require('request')
, options = {};
function initialize(output_location) {
var timestamp = new Date();
options.folder = timestamp.toISOString() + '/';
options.base_url = "s3://zencoder-jobs/"
console.log("Files will be placed in " + options.folder);
getRenditions();
@mmcc
mmcc / stream_to_akamai.md
Last active January 12, 2018 11:27
Stream directly to Akamai

Directly push to Akamai with FMLE

Assuming you already have the appropriate Akamai credentials, you should have some information like this:

Primary: rtmp://p.ep12345.i.akamaientrypoint.net/EntryPoint
Backup:  rtmp://b.ep12345.i.akamaientrypoint.net/EntryPoint
User: ######
Pass: ******
Stream: [EVENT_ANGLE_BITRATE]@12345

Playback: http://zencoder_hd1_1-lh.akamaihd.net/[EVENT_ANGLE_BITRATE]@12345

@mmcc
mmcc / access.ts
Created March 29, 2018 22:52
Simple example to show an issue with array index access.
interface IGenericThing {
bop: [string, string, string];
[key: string]: string | number | [string, string, string];
}
const foo: IGenericThing = {
bar: '#0000ff',
baz: 123,
bat: ['a', 'b', 'c'],
bop: ['d', 'e', 'f'],
@mmcc
mmcc / elixir-example.ex
Last active January 31, 2019 19:55
Node & Elixir Updates
# These examples assume you have your token id and secret in your Mix config:
# config :mux, token_id: 'your-token-id', token_secret: 'your-token-secret'
# Same as above, first we'll create a token with defaults: 7 day expiration for video
video_token = Mux.Token.sign('your-playback-id')
# https://stream.mux.com/your-playback-id.m3u8?token=#{token}
gif_token = Mux.Token.sign('your-playback-id',
type: :gif,
expiration: 60 * 60 * 3 # 3 hours
@mmcc
mmcc / saga.ts
Last active June 28, 2019 22:48
Redux Confirmation Modal Examples
function *deleteAsset (action: Action<'AssetDeleteRequested'>) {
const { payload: { id }, meta: { callbackAction } } = action;
yield put({ type: 'ConfirmAction', payload: { actionType: action.type } });
const { canceled } = yield race({
confirmed: take('ActionConfirmed'),
canceled: take('ActionCanceled'),
});
if (canceled) {