Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

YouTube-API wrapper for FF.au3


  • Please log in to reply
5 replies to this topic

#1 Stilgar

Stilgar

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 423 posts

Posted 21 March 2009 - 10:17 PM

Just a simple YouTube API wrapper for the FF.au3:

_FF_YouTube_API.au3

works with all pages which uses the YouTube-API.

Supported commands:
loadWait / $vArg1 = TimeOut in ms (int), Default = 10000
playVideo
pauseVideo
stopVideo
clearVideo
getVideoBytesLoaded
getvideobytestotal
getVideoStartBytes
mute
unMute
isMuted
setVolume / $vArg1 = Volume (int) (min=0, max=100)
getVolume
seekTo / $vArg1 = Secs (int) / $vArg2 = allowSeekAhead (boolean), Default = true
getPlayerState
getCurrentTime
getDuration
setSize / $vArg1 = height (int) / $vArg2 = width (int) (min=50)
getVideoUrl
getVideoEmbedCode
loadVideoById / $vArg1 = id (string) / $vArg2 = start (int)
cueVideoById / $vArg1 = id (string) / $vArg2 = start (int)


Requirement(s).: FF.au3 >= 0.5.3.0 / MozRepl

Example:
#include <FF.au3> #include <_FF_YouTube_API.au3> If _FFConnect() Then     _FFTabAdd("<iframe id="ytplayer" class="EmbeddedVideo" type="text/html" width="640" height="390" src="http://youtube.com/embed/T-99HbI8zec?html5=1&fs=1" frameborder="0" allowfullscreen webkitallowfullscreen /></iframe>)     If _FF_YT("loadWait") Then         _FF_YT("playVideo")         Sleep(10000)         _FF_YT("pauseVideo")         _FF_YT("seekTo", 90)         Sleep(3000)         _FF_YT("setSize", 300)         MsgBox(64, "Video size in Bytes:", _FF_YT("getVideoBytesTotal"))         Sleep(5000)         _FF_YT("stopVideo")     EndIf     _FFTabClose("YouTube - Fergie Ferg(.*?)-", "label") EndIf

Edited by Stilgar, 29 April 2009 - 05:49 PM.








#2 iLoveAU3

iLoveAU3

    Seeker

  • Active Members
  • 35 posts

Posted 24 March 2009 - 11:56 PM

Hey Stilgar,

do you know why "loadVideoById" / "cueVideoById" does not work properly directly on YT?
movie player always return "We're sorry, this video is no longer available", playerState=3 and then I can't even get videoId.

this is part of code i have added for those functions.
        Case "loadVideoById"             $vArg1 = String($vArg1)             $vArg2 = Number($vArg2)             If $vArg2 = Default Or $vArg2 = "" Then $vArg2 = 0             If IsString($vArg1) And IsNumber($vArg2) Then                 $sCommand = "loadVideoById('" & $vArg1 & "'," & $vArg2 &")"             EndIf         Case "cueVideoById"             $vArg1 = String($vArg1)             $vArg2 = Number($vArg2)             If $vArg2 = Default Or $vArg2 = "" Then $vArg2 = 0             If IsString($vArg1) And IsNumber($vArg2) Then                 $sCommand = 'cueVideoById("' & $vArg1 & '",' & $vArg2 &")"             EndIf


nice work anyway! :D

#3 Stilgar

Stilgar

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 423 posts

Posted 25 March 2009 - 10:36 AM

Hello,

thank you!

That's an problem on YouTube, if you try this on an other page it works:
    _FFTabAdd($Socket,"<a href='http://code.google.com/intl/de-DE/apis/youtube/js_example_1.html' class='bbc_url' title='External link' rel='nofollow external'>http://code.google.com/intl/de-DE/apis/youtube/js_example_1.html"</a>)     _FF_YT($Socket,"loadVideoById","T-99HbI8zec",0,"myytplayer") ; FF.au3 V0.5:     _FFTabAdd("<a href='http://code.google.com/intl/de-DE/apis/youtube/js_example_1.html' class='bbc_url' title='External link' rel='nofollow external'>http://code.google.com/intl/de-DE/apis/youtube/js_example_1.html"</a>)     _FF_YT("loadVideoById","T-99HbI8zec",0,"myytplayer")

but I don't no where this limitation comes from.

With your permission I add your code to the next version. :D

#4 iLoveAU3

iLoveAU3

    Seeker

  • Active Members
  • 35 posts

Posted 25 March 2009 - 12:45 PM

that is right, it works fine except for yt page.

of course, feel free to use this code :D

#5 Stilgar

Stilgar

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 423 posts

Posted 25 March 2009 - 04:10 PM

I've uploaded a new version for FF.au3 > 0.5

- new: loadVideoById, by iLoveAU3
- new: cueVideoById, by iLoveAU3


Download and example at the first post.

#6 Stilgar

Stilgar

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 423 posts

Posted 28 April 2009 - 08:25 PM

Updated to FF.au3 > V0.5.3.0.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users