title: creating a youtube iframe video from my constructor object so I can create multiple videos
body: <p>I am trying to create a youtube video using the youtube iframe api along with a constructor function I'm working on but I've hit a stumbling block. At the moment in my Player function I have created some default properties and then I pass some new properties into my new Object in order to create a player by extending the default and new properties. My problem now is that I'm not sure how I actually initialise the youtube video? Im not sure where <code>player = new YT.Player('player', {</code> should go?</p>
  
  <p>Here is the <strong>JS</strong> im working on and the jsFiddle <a href="http://jsfiddle.net/kyllle/6zuh5/7/" rel="nofollow">http://jsfiddle.net/kyllle/6zuh5/7/</a> </p>
  
  <pre><code>function Player(options) {  
    var $player = $(options.id);
  
    var defaults = {
      height: '100',
      width: '200',
      videoId: 'u1zgFlCw8Aw',
      events: {
        'onReady': onPlayerReady
  
      },
      playerVars: {
        modestbranding: 0,
        controls: 0, //remove controls
        showinfo: 0,
        enablejsapi : 1,
        iv_load_policy: 3
      }
    };
       
    var combinedOptions = _.extend(defaults, options);
    console.log('Combined Options', combinedOptions);
  
    return {    
      pause: function () {      
        $player.pauseVideo();    
      },
          
      seek: function () {       
        //$player.seekTo();          
      },
          
      destroy: function () {      
        $player.destroy();    
      },
          
      changeVideo: function () {      
        $player.stopVideo();    
      }  
    }
  };
  
  function onPlayerReady() {
    console.log('player fired');
  }
  
  var myPlayer = new Player({  
      id: '#divId',
      autoPlay: true,
      videoId: 'asdadads'
  });
  </code></pre>