JSFiddle - React, Tailwind, and code Playground

by Derek Anderson

HTML

<script src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
video id
<input id="video_id" value="_z-hEyVQDRA" />
<input type="button" id="preview" value="preview"/>

<div id="preview_div"/>

JavaScript

(new function () {
    
    this.player = {
        'params': {
            'allowScriptAccess' : 'always'
        },
        'atts': {
            'id' : 'myytplayer'
        },
        'playerid' : 'ytapiplayer',
        'playerstring' : ['http://www.youtube.com/v/',
                         '',
                         '?',
                         'enablejsapi=1',
                         '&playerapiid=ytplayer',
                         '&version=3'],
        'width' : '425',
        'height' : '356'
    };
    
    (function(_this){   
        alert(arguments.callee.caller);
        $('#preview').on('click', function(){
            
            $('#preview_div').empty()
                             .append($('<div/>',{
                                 'id' : _this.player.playerid
                                 })
                             );
            
            _this.player.playerstring[1] = $('#video_id').val();
            
            swfobject.embedSWF(_this.player.playerstring.join(''),
                               _this.player.playerid,
                               _this.player.width, 
                               _this.player.height, 
                               '8', 
                               null, 
                               null, 
                               _this.player.params, 
                               _this.player.atts);
                //light box show code here
            });
        
        //call some lightbox setup code here
    }(this))
}())