javascript - youtube api loadPlaylist on big array of videoIDs -


i've been struggling iframe api past few days trying load large list of videoids. i'm trying load playlist around 380 songs.

now believe read somewhere max size playlist suppose 200 videos. i've cut down array size of around 200 videos , still doesn't work. however, when cut size of array down around 145 playlist load no problem.

what happening, , why seeing kind of functionality? creating playlist improperly? there better way create playlist , allow 380+ videos loaded through playlist?

in code have initial array of around 380 videos called arrayofvideoids. create array called videoids200 arrayofvideoids array spliced down smaller array. have splice cut out first 145 videos. load smaller array in playlist because bigger array not load.

here code, please :) :

//button assignments:  $("#prevbtn").click(function() {    console.log("pressed previousbtn");    previousvideo();  });    $("#pausebtn").click(function() {    console.log("pressed pausebtn");    pausevideo();  });    $("#playbtn").click(function() {    console.log("pressed playbtn");    playvideo();  });    $("#nextbtn").click(function() {    console.log("pressed nextbtn");    nextvideo();  });    var arrayofvideoids = ['kd5flb-wgbu', 'o1o92o5wmyq', '2dnonw18u5e', 'b2ylfcmz51i', 'g0v9fvy6w7q', '47yclvmlthi', 'wyvxahseip4', 'wi2uu3ktq24', 'o1o92o5wmyq', 'vd1xc18qb3k', '436aaeowg4g', '5rtcu_qc760', 'bqsi33fjzm4', 'af3yxsjq8im', 'lsrqhzzfc3y', 'fmanu6egxte', 'luo4po6vawg', 'zohf7ocwomu', 'fuyf6xfzhma', 'vwt-8rxpe3u', 'ciyniksriwo', 'wrtbwjt9cxo', 'c0aphohrhkw', 'wvzfoyw0zmo', 'k1evdadtpem', 'dwyaba9oihy', 'xeq31jqnavi', 'vf_wusxiv00', 'pzao3hj15r4', 'qazors7vefs', '6a7umuaxixi', 'nntgtk2fhb0', 'pqzhn65vq9e', 'z2ffhflkfow', '-y0abj01xjy', 'iapcwlg3nea', 'jyccr1vsxls', 'rpac3l2_sdw', '5e-u-mvjcvu', '-b9nonogboc', '2rxa4pnanmy', '_x7kedvnjee', 'bb3ogwplrlo', 'z4twbrihsnw', 'bpzg12uxswq', 'bydy_3bnopk', 's1g4uoqhhc8', 'vminlhzjxhs', 'q3lqzysrirm', '-bwfdjlkhxq', 'v1wph0hjf-c', 'i_kf4zlnkio', 'nkhhzd64ihm', '-euxibb7xgq', 'hjtnvbtl9rg', 'otafytrizem', 'swts8vtahts', '27d138zhyzq', 'evu5fwkbqf0', '8y38ftb9kbc', 'ff2lz6hnqra', 'bn5dqvygbde', '3_-a9nvzyjk', '6366dxff-os', 'gqdr5th38-w', 'qjjhzkf4wba', 'xppkzx4cpoo', 'e-5e-lqjhno', 'xqw4wo8vdy8', 'sk9xyqmrily', 'cw_o4nltivc', 'hf9rprpp3gu', 'hcezswhg7vo', 'pg_d-jpgqsm', 'zf5umvcgucm', 'p_u3ql2gvbo', 'kczmcmi24gs', '37ryc5azlro', 'apxvscfoynu', 'zovq8g3hcc0', 'vnt4w2s0ot4', 'nqv_bylc2ic', 'ytexdnqqsuc', 's1g4uoqhhc8', 'gvs1yf-erzi', 'dw47_d8zgw0', 'ta9c7o5ulxu', '21yjcwdinfi', 'wvwhhzgnjrc', 'rvemivu77wo', 'bsgnmpsvixg', 'yqew9_5kuri', 'xqw4wo8vdy8', '3_-a9nvzyjk', 'snppm_-r6s4', 'lwizvjvhqba', '2q74tyturto', 'y7ocgi7ranc', '5lnl_aodcuw', 'nntgtk2fhb0', 'e8pnta0mtw0', 'ta9c7o5ulxu', 'winkozioyqc', 'bsgnmpsvixg', 'qazors7vefs', '1x1wjgkhjbi', 'gcdwkhttnnw', 'oclek4aspbo', 'hyru9vcxsl0', 'gz2gvlqkn4q', 'ffbkqavk2co', '_nw5af0m9zw', '5bfsewnmlds', 'dx3k_qdnzhe', 'uj_1hmagb4k', 'llk4oaxuulg', 'jlaej6k75cy', 'uknoakeueqy', 'hzvfgee26ve', 'q5_47elxb8o', 'dccxq9qb-dq', 'p2rt2vw9i_k', 'ywyhznbz6fe', 'gekljbcpedw', 'l-rqz6ighcm', 'cxnapa8ohmm', '88sth9fvojq', 'atrkzikbm7a', 'oancodpky6e', 'gcdwkhttnnw', 'rfmg7nyzn6o', 'fkfilctiknm', '_l2vjeb6lve', 'j5-ykhdd64s', 'hcvv9r1zr84', '4eyzjxgvro0', 'ybnvcj_zpsy', 'mi2l7u5n0li', '8y38ftb9kbc', 'qtnj_ooojqq', 'pfcyrqw9ywy', 'zkaeootuf4w', 'e1qtnllgjai', 'xygshowne0m', 'bcqt_uvnwe8', 'z6zdx-l4xsg', 'cczetcahve0', '1612_y7n9x4', 'k0jkjisefxy', 'bbeornaoibs', 'sdtz7ix4vtq', 'mqi_o3kifhm', 'ijk4j-r7qpa', 'ombmgxuw6yq', 'pwgvgjahviw', 'jkamiarlgvy', 'zxpmk3pvz44', 'vprjceobqri', 'vehhh8ibhpy', 'p4qhqfbakaq', 'bgra1m1f90g', 'jbz5d8i1ohi', 'jbz5d8i1ohi', 'sexbixcebky', 'ibhngv6_znu', 'ygspaxgadze', 'mzjj5-lubem', 'l1p_nhfd8jm', '3cqu1pfrqye', '312sb-2pova', '0uc3zrmhdn4', 'pwgvgjahviw', 'eo8yrtg3y5w', 'vckfse3vorc', 'ffhs6_b8tzs', 'hafffqiylp0', '3cqu1pfrqye', 'nxr1yk3ydwq', 'xluvygoooke', 'wrcpcntviga', 'jzik5fac38w', 'qp6coee-ijg', '8lbkxp_ucbq', '_zplr-o-yeq', 'gomt8cj0pg0', 'gkime9m4z34', 'py2pzqyfhr0', '6phkfhkqh3w', 'l2nhfzcvmba', 'mp-izefqrg0', 'ixxstccjlsc', 'zxbky7eu3qg', 'll-gyhzvvx0', 'tgx0rapsk6w', 'ozzfzwboyqm', 'ylcm9lp-3uk', '6zwjuv53dgi', 'auw2bndbdbq', '0mvck88w01i', 'jpihuaonilu', 'isfug005flg', 'ktyd_kn7rpg', '6bbvtgidzk8', 'hhtwwtmfbh4', 'lv5_xj_yuhs', 'gfahxdkwdxs', 'wvzfoyw0zmo', 'zxpmk3pvz44', 'vd3d7aw4zns', '4uc9bryhlms', 'jgow4nmykka', 'wb5voqexmbu', 'i-gyz35074k', 'go1ih209nlu', 'q8kuckz15fe', 'zlf-v1la8te', 'j1r541qfxxc', 'i1czsw7opui', '-m7e7tcn7bk', '5mj08-pydlg', 'p-jrwen_r1u', '_svq_qdvktg', 'eyomdtxcfce', '2739zwjgnt0', 'ooevvqwq-lm', 'e1iotvqmr5i', '2sbowe-xjqk', 'akhms1d2ce4', '-tpevdvunc4', 'pebj4qlimu0', 'pjgfyqmwtqo', 'pebj4qlimu0', 'ixptthi94tg', '_o6ve7erp2w', 'eac4zhedd7o', '-0oznwif_jk', 'udf1wfionwy', '_o6ve7erp2w', '5rnepy_awq0', '30beqaiu_sa', '_ueklamqxwy', 'my2frpa3gf8', 'trpulbquym0', 'dweqtbafvxu', 'cfwse72zuoc', 'tczpioxjyc4', 'axfnepttov4', 'oo5t0vwsdbu', 'zeaivjoh1fy', 'ug_bbvlp3da', 'pjgtg6ne5ay', 'ktvtqkndobu', 'm0fdmjw3r2m', 'iot_s_kdueq', 'iz9ahuv7qly', 'uqmmhyafapy', 'wg2ypkh8vdo', 'zeaivjoh1fy', 'cgot8dzrshk', 'jaawdljhd5o', 'p74sryhpnau', '2cxdgfwe13g', 'wslnldzxpse', 'enpwq0tfsfu', 'bydkk95cpfm', 'pn1vgytzxus', 'xzxdswz3nbw', 'hcdgdxqbw_u', 'bmsbobsa7w8', 'xvf48bb6nvi', 'r9ppyskiwlu', 'yupmabazavm', '6pf-ajbtcxm', 'z8farcnm1me', 'w7ffcjb8jzq', 'zrh3vnfqcmu', 'bioafbyfc54', 'bydkk95cpfm', 'ivm7t8an9em', 't8p_ewi7ddq', 'g5ehr5u7mpe', 'bwfbohew07y', 'nfnkgiptbq0', 'avrkechp0kk', 'qsimpcabm_w', 'oyws8biwoyc', 'ylqnuikudie', 'cdbwn1golgi', 'qtowsrgbmg8', 'jdr557tvolm', 'fskqpofuquk', 'ca3hhfffh-k', '1o-kvvpbg-a', 'z8oggxybgr4', 'k779kedcuua', 'el0ukiqdt2i', 'vux_zwx3jpg', 'ltx3g6h2xya', '_nzzxleyose', 'bfwpigmc-ai', 'wskzd8y5rvi', 'zrndixsgiyc', 'k1vlaxorrdk', 'w2yv8at0ufc', 'erywpdffore', 'fdyidbzul2y', 'cmfrxxtvfd8', '6bssmyg9pje', '5ot2m1r-xym', 'rfwritehw6k', 'pebj4qlimu0', '7pkrvb5f2w0', 'cucdamuku_e', 'pny7ibwhhg4', '0_b57fvyyso', '9v0fxx6dqp0', 'hafffqiylp0', '3iuuwk0jghk', 'auduyknage8', 'vlkad81wcd4', 'imixg3jrjs8', 'tv_8npbe4-y', 'yxwyjyrkk5a', 'ub36ffwaqgq', 'mmzexg8sxyk', '6hz8fuw5adc', 'dhjriezyzc8', 'fww66b9jfyo'];    var videoids200 = arrayofvideoids.slice(0, 145);    $("#pressme").click(function() {    console.log(arrayofvideoids);    console.log(videoids200);  });    var player;    function onyoutubeiframeapiready() {    console.log('onyoutubeiframapiready()');      player = new yt.player('player', {      height: '390',      width: '640',      videoid: '',      playervars: {        'enablejsapi': 1,        'modestbranding': 1,        'playsinline': 0,        'rel': 0,        'autoplay': 1      },      events: {        'onready': onplayerready,        'onstatechange': onplayerstatechange      }    });  }    // 4. api call function when video player ready.  function onplayerready(event) {    console.log("onplayerready()")    event.target.loadplaylist(videoids200);    //event.target.playvideo();  }    // 5. api calls function when player's state changes.  //    function indicates when playing video (state=1),  //    player should play 6 seconds , stop.  function onplayerstatechange(event) {    if (event.data === yt.playerstate.cued) {      console.log("player state: cued");    }      if (event.data === yt.playerstate.cued && event.data !== yt.playerstate.playing) {      console.log("player state: cued , not playing");      player.playvideo();    }      if (event.data === yt.playerstate.ended) {      console.log("player state: ended");      playnext();    }      if (event.data === yt.playerstate.playing) {      console.log("player state: playing");    }      if (event.data === yt.playerstate.paused) {      console.log("player state: paused");    }      if (event.data === yt.playerstate.buffering) {      console.log("player state: buffering");    }  }      // loads , plays next video  function nextvideo() {    player.nextvideo();  }    // loads , plays previous video  function previousvideo() {    player.previousvideo();  }    // plays video in playlist @ specified index  function playvideoat(index) {    player.playvideoat(index);  }    //playback controls    // plays cued/loaded video  function playvideo() {    player.playvideo();  }    // pauses playing video  function pausevideo() {    player.pausevideo();  }
<!doctype html>  <html>    <head>    <title>the real 8tracks scraper</title>      <meta charset="utf-8" />    <meta http-equiv="content-type" content="text/html; charset=utf-8" />    <meta name="viewport" content="width=device-width, initial-scale=1" />        <!-- include jquery -->    <script src="//code.jquery.com/jquery-1.11.3.min.js"></script>      <!-- include bootstrap -->    <!-- latest compiled , minified css -->    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">    <!-- optional theme -->    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">    <!-- latest compiled , minified javascript -->    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>      <!-- include youtube iframe api -->    <script type="text/javascript" src="http://www.youtube.com/iframe_api"></script>    </head>    <body>    <!-- 1. <iframe> (and video player) replace <div> tag. -->    <div id="player"></div>    <div id="player"></div>    <button class="btn" id="pressme">press me</button>    <button class="btn" id="prevbtn">      <<</button>        <button class="btn" id="pausebtn">||</button>        <button class="btn" id="playbtn">|></button>        <button class="btn" id="nextbtn">>></buton>  </body>    </html>


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -