Note that there are some explanatory texts on larger screens.

plurals
  1. POYoutube javascript API (with ASP) functions not working
    primarykey
    data
    text
    <p>I've got a program which takes Youtube URLs from a database, and I'm having trouble with the Youtube javascript API.</p> <p>In my codebehind, I'm calling the following code:</p> <pre><code>Table1.Rows(0).Cells(0).Text = "&lt;object style=""height: 390px; width: 640px"" id=""ytplayer""&gt;" &amp; _ "&lt;param name=""movie"" value=""https://www.youtube.com/v/UASyS-jUKKI?version=3&amp;feature=player_embedded&amp;controls=0&amp;enablejsapi=1&amp;showinfo=0&amp;iv_load_policy=3&amp;playerapiid=ytplayer""&gt;" &amp; _ "&lt;param name=""allowfullscreen"" value=""true""&gt;" &amp; _ "&lt;param name=""allowscriptaccess"" value=""always""&gt;" &amp; _ "&lt;embed src=""https://www.youtube.com/v/UASyS-jUKKI?version=3&amp;feature=player_embedded&amp;controls=0&amp;enablejsapi=1&amp;showinfo=0&amp;iv_load_policy=3&amp;playerapiid=ytplayer"" type=""application/x-shockwave-flash"" allowfullscreen=""true"" allowscriptaccess=""always"" width=""425"" height=""344"" id=""ytplayer""&gt;&lt;/object&gt;" </code></pre> <p>(where I'll reference the sources to records in my database).</p> <p>This embeds it on the page fine, and it plays, but I want to use API functions, which aren't working for me.</p> <pre><code>var vid; function onYouTubePlayerReady(id) { vid = id; var video = document.GetElementById(vid); video.playVideo() } function play() { var vobj; if (vid) { vobj = document.getElementById(vid); alert(vobj); vobj.playVideo(); } } &lt;a href="javascript:void(0);" onclick="play();"&gt;Play&lt;/a&gt; </code></pre> <p>I know that it's successfully calling the 'onYouTubePlayerReady' function (and returning the ID), but play/pause/stop etc. aren't working. Anybody know how to fix this? </p> <p>It is running on a server, not locally.</p> <p>Thanks </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload