Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Access to javascript youtube player
Message
From
25/03/2017 13:07:06
Thomas Ganss (Online)
Main Trend
Frankfurt, Germany
 
 
To
25/03/2017 12:46:29
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Miscellaneous
Thread ID:
01649327
Message ID:
01649328
Views:
62
looong time ago I automated IE from vfp - sometimes directly, sometimes as part of special forms.
Easiest thing is to call .click on specific HTML controls.
Worked reliably with old IE, best set up a new VM with W2K or XP and keep IE6 or below - at least that was my way when I did a small stint again in 2009. Might have been me trying to force newer IE capabilities into old interface usage, dunno, but that worked fast for me.
Coherent info was for a long time available at west-wind, as Rick blogged about using newer versions, AFAIR also some hints on modifying unwanted behaviour via registry entries.

Externally controlling the browser still is a valid option for many use cases, but if startng from zero today I'd probably opt for using a specific browser and do my controlling via JS. Perhaps via Webview, depends on targeted users. COM/DCOM calling from non-IE browsers not really in the DNA, but probably more future proof.

Perhaps look into Selenium or other tools to automate web sites.
IIRC on IE all scripts/functions were available via a top level collection, uncertain if that was a DOM or IE specific thing.

my 0.02€

thomas




>this question is relative to [javascript & vfp] users.
>
>youtube player is a javascript "object" whose fills an iframe in a div in body/html/page.
>its created by a script of the https://www.youtube.com/player_api
>this follow is a common main javascript code for that in a web page:
>
><body scroll="no">
>		<div id="ytplayer"></div>
>
>		<script>
>		  // Load the IFrame Player API code asynchronously.
>		  var tag = document.createElement('script');
>		  tag.src = "https://www.youtube.com/player_api";
>		  var firstScriptTag = document.getElementsByTagName('script')[0];
>		  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
>		  // Replace the 'ytplayer' element with an <iframe> and
>		  // YouTube player after the API code downloads.
>
>		  var player;
>		  function onYouTubePlayerAPIReady() {
>		    player = new YT.Player('ytplayer', {
>		      width: '640',
>		      height: '480',
>		      playerVars: {autoplay:1, loop:0,rel:0,enablejsapi:1,frameborder:0 ,allowfullscreen:1,controls:0},
>		      videoId: 'M7lc1UVf-VE'
>		    });
>		  }
>		  </script>
></body>
>
>if save this code as an html file and open it in browser: it plays a youtube video...
>
>i made in javascript code:controls=0 in settings to dont see the toolbar youtube player (play,pause,stop,volume,currentTime,duration,Fullscreen,......).
>this toolbar appears at the bottom of the player (if controls=1 ;0 for hidden).
>
>Questions:
>i want to command the player as well as the native toolbar does but from vfp exclusively.
>
>how can i access at runtime, from vfp,to the player object (if the case : in javascript ist a VAR..) and its commands (out of given known shortcuts) like
> -play,pause,stop,getVolume, setVolume by a slider or spinner,duration,current time,fullscreen on/off.....
>
>thanks in advance .
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform