1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: API to interface with YouTube via libcurl and OpenSSL
//
// $NoKeywords: $
//=============================================================================
#ifndef YOUTUBEAPI_H
#define YOUTUBEAPI_H
#ifdef _WIN32
#pragma once
#endif
#include "basetypes.h"
class CUtlString;
enum eYouTubeLoginStatus
{
kYouTubeLogin_NotLoggedIn,
kYouTubeLogin_LoggedIn,
kYouTubeLogin_Pending,
kYouTubeLogin_CouldNotConnect,
kYouTubeLogin_Forbidden,
kYouTubeLogin_GenericFailure,
kYouTubeLogin_Cancelled,
};
enum eYouTubeAccessControl
{
kYouTubeAccessControl_Public,
kYouTubeAccessControl_Private,
kYouTubeAccessControl_Unlisted,
};
DECLARE_POINTER_HANDLE(YouTubeUploadHandle_t);
DECLARE_POINTER_HANDLE(YouTubeInfoHandle_t);
/**
* Interface to general response handler for YouTube requests
*/
class CYouTubeResponseHandler
{
public:
/**
* Invoked in the main thread after a response has been fully received.
* @param pResponse
*/
virtual void HandleResponse( long responseCode, const char *pResponse ) = 0;
};
/**
* Set application specific developer settings, which must be set before trying to log in the user or upload a video
* @param pDeveloperKey
* @param pDeveloperTag
*/
void YouTube_SetDeveloperSettings( const char *pDeveloperKey, const char *pDeveloperTag );
/**
* Attempt to log the user in over SSL
* @param pUserName
* @param pPassword
* @param pSource
*/
void YouTube_Login( const char *pUserName, const char *pPassword, const char *pSource );
/**
* Cancel the login process.
*/
void YouTube_LoginCancel();
/**
* @return eYouTubeLoginStatus
*/
eYouTubeLoginStatus YouTube_GetLoginStatus();
/**
* @return YouTube login name
*/
const char *YouTube_GetLoginName();
/**
* @return the URL to the YouTube profile, if the user is logged in
*/
bool YouTube_GetProfileURL( CUtlString &strProfileURL );
/**
* Attempt to upload a movie file to YouTube
* @param pFilePath full path to the file
* @param pMimeType i.e. "video/mp4"
* @param pTitle (must be less than 60 characters)
* @param pDescription
* @param pCategory - usually "Games" (see category terms in http://gdata.youtube.com/schemas/2007/categories.cat)
* @param pKeywords
* @param access
* @param pURLToVideo if the upload was successful, this string will be a URL to the video on YouTube
* @return true if the video was uploaded successfully, false otherwise
*/
YouTubeUploadHandle_t YouTube_Upload( const char* pFilePath, const char *pMimeType, const char *pTitle, const char *pDescription, const char *pCategory, const char *pKeywords, eYouTubeAccessControl access );
/**
* @param handle
* @return true if upload is finished, false otherwise
*/
bool YouTube_IsUploadFinished( YouTubeUploadHandle_t handle );
/**
* Get the progress of the upload
* @param handle
* @param flPercentage the parameter to be filled in
* @return true if the upload is still valid, false otherwise
*/
bool YouTube_GetUploadProgress( YouTubeUploadHandle_t handle, double &ultotal, double &ulnow );
/**
* @param handle
* @param bSuccess
* @param strURLToVideo
*/
bool YouTube_GetUploadResults( YouTubeUploadHandle_t handle, bool &bSuccess, CUtlString &strURLToVideo, CUtlString &strURLToVideoStats );
/**
* Clear status of the upload
* @param handle
*/
void YouTube_ClearUploadResults( YouTubeUploadHandle_t handle );
/**
* Cancel the upload of a video
* @param handle
*/
void YouTube_CancelUpload( YouTubeUploadHandle_t handle );
/**
* Asynchronously retrieve information for the given video.
* @param pURLToVideoStats
* @param responseHandler
*/
YouTubeInfoHandle_t YouTube_GetVideoInfo( const char *pURLToVideoStats, CYouTubeResponseHandler &responseHandler );
/**
* @param handle
*/
void YouTube_CancelGetVideoInfo( YouTubeInfoHandle_t handle );
#endif // YOUTUBEAPI_H
|