JSFiddle - React, Tailwind, and code Playground
by darcyclarke
HTML
<div id="flixel"></div>
JavaScript
var hash = "http://f.cl.ly/items/1z0b3c1n1b3r1E3n2e28/c9eyu02jscuxbhnmo7e3";
(function(window, undefined){
'use strict';
// Console.log Debugging
console.log = (true) ? console.log : function(){};
// Tiny Pubsub
(function(a){var b=a({});a.subscribe=function(){b.on.apply(b,arguments)},a.unsubscribe=function(){b.off.apply(b,arguments)},a.publish=function(){b.trigger.apply(b,arguments)}})(jQuery);
// Flixel Plugin
jQuery(function($){
// Setup
var _this = this;
var local = !!(parent && parent.document && parent.document.location && parent.document.location.indexOf('flixel.com') >= 0);
var options = { flash: false, canvas: false };
var $html = $('html');
var $body = $('body');
var $el = $('#flixel');
var $video = $('<video class="hidden">');
var $canvas = $('<canvas>');
var $img = $('<img>');
var video;
var ext;
var params = (function(){
var arr = window.location.search.replace('?', '').split('&');
var obj = {};
for(var i = 0;i < arr.length; i++){
var temp = arr[i].split('=');
obj[temp[0]] = temp[1];
}
return obj;
})();
// Check for remote embed and add class accordingly
if(!local)
$body.addClass('embedded');
// Get flixel source from "v" param
var src = hash || decodeURIComponent(params.v) || null;
// Set placeholder image
var $placeholder = $('<img src="' + src + '.thumbnail.jpg">');
// Check existence of source, exit if falsey
if(!src) return;
// Setup video
$video.attr({ autoplay: '', loop: '', autobuffer: '', preload: '', volume: 0 });
// Insert video to DOM
$video = $video.appendTo($el);
video = $video[0];
// Check support
var supports = (function(){
var _this = {}, temp;
_this.webm = false;
_this.mp4 = false;
_this.autoplay = ('autoplay' in video);
_this.loop = ('loop' in video);
_this.canvas = !!($canvas[0].getContext &&...