diff options
Diffstat (limited to 'assets/js/sample.js')
| -rw-r--r-- | assets/js/sample.js | 25 | 
1 files changed, 19 insertions, 6 deletions
| diff --git a/assets/js/sample.js b/assets/js/sample.js index 1784e86..4297ccd 100644 --- a/assets/js/sample.js +++ b/assets/js/sample.js @@ -5,15 +5,28 @@ function Sample(url){    this.duration;    this.key;    this.player; //the associated player obj w the iframe -  this.init();    this.id; +  this.iframe; +  this.init();  } -Sample.prototype.init(){ -  //create the iframe - -  //create the player - +Sample.prototype.init = function(){ +  var that = this; +  $.embedly.oembed(this.url).done(function(results){ +    var BASE_IFRAME = "http://cdn.embedly.com/widgets/media.html"; +    var data = results[0]; +    var f= data.html; +    var src = $(f)[0].src; +    var schema = data.provider_name.toLowerCase(); +    var iframe_src= BASE_IFRAME +"?schema="+schema+"&type=text%2Fhtml&html="+src; +    var iframe = $('<iframe/>', { +      src: iframe_src +    }); +    $('body').append(iframe[0]); +    var player = new OP.Player(iframe[0]); +    that.player = player; +    that.iframe = iframe; +  });  }  Sample.prototype.play = function(){ | 
