set method
Supply the videoId
and retrieve the url used to upload the thumbnail image
Implementation
Future<ThumbnailSetResponse> set(
{required String videoId, required File thumbnail}) async {
final String uploadType = 'resumable';
final httpResponse =
await _rest.location(_authHeader, accept, videoId, uploadType);
if (!httpResponse.response.headers.map.containsKey('location')) {
throw Exception(
'Upload location for the thumbnail could not be determined');
}
return await _rest.upload(
_authHeader,
'application/x-www-form-urlencoded',
videoId,
httpResponse.response.headers.value('location')!,
thumbnail,
uploadType);
}