javascript - JS/Jquery youtube video won't play -


this link site : http://www.cimbbank.com.my/en/business/products/cash-management/collections-cimb/plug-n-pay-by-cimb-bank.html

been fiddling around figure out why youtube video won't play. i'm not sure missed. it's not playing. have 2 iframes both videos. guess there's nothing wrong css.

this js youtube component:

  function getframeid(id) {         var elem = document.getelementbyid(id);         if (elem) {             if (/^iframe$/i.test(elem.tagname)) return id; //frame, ok             // else: frame             var elems = elem.getelementsbytagname("iframe");             if (!elems.length) return null; //no iframe found, failure             (var = 0; < elems.length; i++) {                 if (/^https?:\/\/(?:www\.)?youtube(?:-nocookie)?\.com(\/|$)/i.test(elems[i].src)) break;             }             elem = elems[i]; //the only, or best iframe             if (elem.id) return elem.id; //existing id, return             // else: create new id             { //keep postfixing `-frame` until id unique                 id += "-frame";             } while (document.getelementbyid(id));             elem.id = id;             return id;         }         // if no element, return null.         return null;     }      // define yt_ready function.     var yt_ready = (function() {         var onready_funcs = [],             api_isready = false;     /* @param func function     function execute on ready              * @param func boolean      if true, qeued functions executed              * @param b_before boolean  if true, func added first                                          position in queue*/         return function(func, b_before) {             if (func === true) {                 api_isready = true;                 (var = 0; < onready_funcs.length; i++) {                     // removes first func array, , execute func                     onready_funcs.shift()();                 }             }             else if (typeof func == "function") {                 if (api_isready) func();                 else onready_funcs[b_before ? "unshift" : "push"](func);             }         }     })();     // function called when api loaded      function onyoutubeplayerapiready() {         yt_ready(true)     }      var players = {};     //define player storage object, enable later function calls,     //  without having create new class instance again.     yt_ready(function() {         $(".youtube_overlay_thumb + iframe[id]").each(function() {             var identifier = this.id;             var frameid = getframeid(identifier);             if (frameid) { //if frame exists                 players[frameid] = new yt.player(frameid, {                     events: {                         "onready": createytevent(frameid, identifier)                     }                 });             }         });     });       // returns function enable multiple events     function createytevent(frameid, identifier) {         return function (event) {             var player = players[frameid]; // player object             var the_div = $('#'+identifier).parent();             the_div.children('.youtube_overlay_thumb').click(function() {                 var $this = $(this);                 $this.fadeout().next().addclass('play');                 if ($this.next().hasclass('play')) {                     player.playvideo();                 }             });         }     }      (function(){ //closure, not leak scope       var s = document.createelement("script");       s.src = "https://www.youtube.com/player_api"; /* load player api*/       var before = document.getelementsbytagname("script")[0];       before.parentnode.insertbefore(s, before);     })();      // etc      $('.youtube_overlay_thumb').click(function(){     var videoname = $('.videoname').val();         s.linktrackvars = "events,evar24,prop24";         s.linktrackevents = "event19";         s.events = "event19";         s.evar24 = videoname;         s.prop24 = videoname;     s.tl(this,'o','youtube-video-player');     }) 

i tried playing video chrome browser. console showing me playvideo() of player undefined. there might problem in initializing player responsible issue playing youtube video. check whether initializing player properly.


Comments