Getting started with TMS FNC Cloud Google YouTube
Prerequisites
- TMS FNC Core installed and the runtime package added to the project.
- TMS FNC Cloud Pack installed.
- A Google account with a YouTube channel, and an OAuth 2.0 client (client ID and secret) created in the Google Cloud console with the YouTube Data API enabled.
Add the component
- Drop
TTMSFNCCloudGoogleYouTubeonto a form or create it in code. - Set the OAuth credentials (
Authentication.ClientID,Authentication.Secret,Authentication.CallBackURL). - Persist tokens and call
Connect; onceOnConnectedfires, callGetAllVideosorUploadVideo.
The minimal connect sequence — credentials, token persistence, and an
OnConnected handler that loads the channel's videos:
procedure TForm1.SetupYouTube;
begin
FYouTube := TTMSFNCCloudGoogleYouTube.Create(Self);
// OAuth 2.0 client credentials from the Google Cloud console (YouTube Data API enabled).
FYouTube.Authentication.ClientID := '<your-client-id>.apps.googleusercontent.com';
FYouTube.Authentication.Secret := '<your-client-secret>';
FYouTube.Authentication.CallBackURL := 'http://127.0.0.1:8888/';
// Persist tokens so the consent screen only appears on first run.
FYouTube.PersistTokens.Location := plIniFile;
FYouTube.PersistTokens.Key := TTMSFNCUtils.AddBackslash(TTMSFNCUtils.GetDocumentsPath)
+ FYouTube.ClassName + '.ini';
FYouTube.LoadTokens;
FYouTube.OnConnected := YouTubeConnected;
FYouTube.Connect; // opens the browser for consent on first run, then fires OnConnected
end;
procedure TForm1.YouTubeConnected(Sender: TObject);
begin
// Tokens are valid here - safe to query or upload.
FYouTube.GetAllVideos;
end;
void __fastcall TForm1::SetupYouTube()
{
FYouTube = new TTMSFNCCloudGoogleYouTube(this);
// OAuth 2.0 client credentials from the Google Cloud console (YouTube Data API enabled).
FYouTube->Authentication->ClientID = "<your-client-id>.apps.googleusercontent.com";
FYouTube->Authentication->Secret = "<your-client-secret>";
FYouTube->Authentication->CallBackURL = "http://127.0.0.1:8888/";
// Persist tokens so the consent screen only appears on first run.
FYouTube->PersistTokens->Location = plIniFile;
FYouTube->PersistTokens->Key = TTMSFNCUtils::AddBackslash(TTMSFNCUtils::GetDocumentsPath())
+ FYouTube->ClassName() + ".ini";
FYouTube->LoadTokens();
FYouTube->OnConnected = YouTubeConnected;
FYouTube->Connect(); // opens the browser for consent on first run, then fires OnConnected
}
void __fastcall TForm1::YouTubeConnected(TObject *Sender)
{
// Tokens are valid here - safe to query or upload.
FYouTube->GetAllVideos();
}
Next steps
- Guides — authentication, working with videos, and reading comments.
- API reference — full class reference.