Sign in to follow this  
Followers 0

YouTube-API wrapper for FF.au3

6 posts in this topic

#1 ·  Posted (edited)

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("http://www.youtube.com/watch?v=T-99HbI8zec")

    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

Share this post


Link to post
Share on other sites



#2 ·  Posted

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

Share this post


Link to post
Share on other sites

#3 ·  Posted

Hello,

thank you!

That's an problem on YouTube, if you try this on an other page it works:

_FFTabAdd($Socket,"http://code.google.com/intl/de-DE/apis/youtube/js_example_1.html")
    _FF_YT($Socket,"loadVideoById","T-99HbI8zec",0,"myytplayer")

; FF.au3 V0.5:
    _FFTabAdd("http://code.google.com/intl/de-DE/apis/youtube/js_example_1.html")
    _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

Share this post


Link to post
Share on other sites

#4 ·  Posted

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

of course, feel free to use this code :D

Share this post


Link to post
Share on other sites

#5 ·  Posted

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0