Class VideoIntelligenceServiceClient (3.0.0)

public abstract class VideoIntelligenceServiceClient

VideoIntelligenceService client wrapper, for convenient use.

Inheritance

Object > VideoIntelligenceServiceClient

Namespace

Google.Cloud.VideoIntelligence.V1

Assembly

Google.Cloud.VideoIntelligence.V1.dll

Remarks

Service that implements the Video Intelligence API.

Properties

AnnotateVideoOperationsClient

public virtual OperationsClient AnnotateVideoOperationsClient { get; }

The long-running operations client for AnnotateVideo.

Property Value
TypeDescription
OperationsClient

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the VideoIntelligenceService service, which is a host of "videointelligence.googleapis.com" and a port of 443.

Property Value
TypeDescription
String

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default VideoIntelligenceService scopes.

Property Value
TypeDescription
IReadOnlyList<String>
Remarks

The default VideoIntelligenceService scopes are:

GrpcClient

public virtual VideoIntelligenceService.VideoIntelligenceServiceClient GrpcClient { get; }

The underlying gRPC VideoIntelligenceService client

Property Value
TypeDescription
VideoIntelligenceService.VideoIntelligenceServiceClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
TypeDescription
ServiceMetadata

Methods

AnnotateVideo(AnnotateVideoRequest, CallSettings)

public virtual Operation<AnnotateVideoResponse, AnnotateVideoProgress> AnnotateVideo(AnnotateVideoRequest request, CallSettings callSettings = null)

Performs asynchronous video annotation. Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains AnnotateVideoProgress (progress). Operation.response contains AnnotateVideoResponse (results).

Parameters
NameDescription
requestAnnotateVideoRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<AnnotateVideoResponse, AnnotateVideoProgress>

The RPC response.

Example
// Create client
VideoIntelligenceServiceClient videoIntelligenceServiceClient = VideoIntelligenceServiceClient.Create();
// Initialize request argument(s)
AnnotateVideoRequest request = new AnnotateVideoRequest
{
    InputUri = "",
    Features =
    {
        Feature.Unspecified,
    },
    VideoContext = new VideoContext(),
    OutputUri = "",
    LocationId = "",
    InputContent = ByteString.Empty,
};
// Make the request
Operation<AnnotateVideoResponse, AnnotateVideoProgress> response = videoIntelligenceServiceClient.AnnotateVideo(request);

// Poll until the returned long-running operation is complete
Operation<AnnotateVideoResponse, AnnotateVideoProgress> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
AnnotateVideoResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AnnotateVideoResponse, AnnotateVideoProgress> retrievedResponse = videoIntelligenceServiceClient.PollOnceAnnotateVideo(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AnnotateVideoResponse retrievedResult = retrievedResponse.Result;
}

AnnotateVideo(String, IEnumerable<Feature>, CallSettings)

public virtual Operation<AnnotateVideoResponse, AnnotateVideoProgress> AnnotateVideo(string inputUri, IEnumerable<Feature> features, CallSettings callSettings = null)

Performs asynchronous video annotation. Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains AnnotateVideoProgress (progress). Operation.response contains AnnotateVideoResponse (results).

Parameters
NameDescription
inputUriString

Input video location. Currently, only Cloud Storage URIs are supported. URIs must be specified in the following format: gs://bucket-id/object-id (other URI formats return [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see Request URIs. To identify multiple videos, a video URI may include wildcards in the object-id. Supported wildcards: '*' to match 0 or more characters; '?' to match 1 character. If unset, the input video should be embedded in the request as input_content. If set, input_content must be unset.

featuresIEnumerable<Feature>

Required. Requested video annotation features.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<AnnotateVideoResponse, AnnotateVideoProgress>

The RPC response.

Example
VideoIntelligenceServiceClient client = VideoIntelligenceServiceClient.Create();
Operation<AnnotateVideoResponse, AnnotateVideoProgress> operation = client.AnnotateVideo(
    "gs://cloud-samples-data/video/gbikes_dinosaur.mp4",
    new[] { Feature.LabelDetection });
Operation<AnnotateVideoResponse, AnnotateVideoProgress> resultOperation = operation.PollUntilCompleted();

VideoAnnotationResults result = resultOperation.Result.AnnotationResults[0];
foreach (LabelAnnotation label in result.ShotLabelAnnotations)
{
    Console.WriteLine($"Label entity: {label.Entity.Description}");
    Console.WriteLine("Frames:");
    foreach (LabelSegment segment in label.Segments)
    {
        Console.WriteLine($"  {segment.Segment.StartTimeOffset}-{segment.Segment.EndTimeOffset}: {segment.Confidence}");
    }
}

AnnotateVideoAsync(AnnotateVideoRequest, CallSettings)

public virtual Task<Operation<AnnotateVideoResponse, AnnotateVideoProgress>> AnnotateVideoAsync(AnnotateVideoRequest request, CallSettings callSettings = null)

Performs asynchronous video annotation. Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains AnnotateVideoProgress (progress). Operation.response contains AnnotateVideoResponse (results).

Parameters
NameDescription
requestAnnotateVideoRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<AnnotateVideoResponse, AnnotateVideoProgress>>

A Task containing the RPC response.

Example
// Create client
VideoIntelligenceServiceClient videoIntelligenceServiceClient = await VideoIntelligenceServiceClient.CreateAsync();
// Initialize request argument(s)
AnnotateVideoRequest request = new AnnotateVideoRequest
{
    InputUri = "",
    Features =
    {
        Feature.Unspecified,
    },
    VideoContext = new VideoContext(),
    OutputUri = "",
    LocationId = "",
    InputContent = ByteString.Empty,
};
// Make the request
Operation<AnnotateVideoResponse, AnnotateVideoProgress> response = await videoIntelligenceServiceClient.AnnotateVideoAsync(request);

// Poll until the returned long-running operation is complete
Operation<AnnotateVideoResponse, AnnotateVideoProgress> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
AnnotateVideoResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AnnotateVideoResponse, AnnotateVideoProgress> retrievedResponse = await videoIntelligenceServiceClient.PollOnceAnnotateVideoAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AnnotateVideoResponse retrievedResult = retrievedResponse.Result;
}

AnnotateVideoAsync(AnnotateVideoRequest, CancellationToken)

public virtual Task<Operation<AnnotateVideoResponse, AnnotateVideoProgress>> AnnotateVideoAsync(AnnotateVideoRequest request, CancellationToken cancellationToken)

Performs asynchronous video annotation. Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains AnnotateVideoProgress (progress). Operation.response contains AnnotateVideoResponse (results).

Parameters
NameDescription
requestAnnotateVideoRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<AnnotateVideoResponse, AnnotateVideoProgress>>

A Task containing the RPC response.

Example
// Create client
VideoIntelligenceServiceClient videoIntelligenceServiceClient = await VideoIntelligenceServiceClient.CreateAsync();
// Initialize request argument(s)
AnnotateVideoRequest request = new AnnotateVideoRequest
{
    InputUri = "",
    Features =
    {
        Feature.Unspecified,
    },
    VideoContext = new VideoContext(),
    OutputUri = "",
    LocationId = "",
    InputContent = ByteString.Empty,
};
// Make the request
Operation<AnnotateVideoResponse, AnnotateVideoProgress> response = await videoIntelligenceServiceClient.AnnotateVideoAsync(request);

// Poll until the returned long-running operation is complete
Operation<AnnotateVideoResponse, AnnotateVideoProgress> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
AnnotateVideoResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AnnotateVideoResponse, AnnotateVideoProgress> retrievedResponse = await videoIntelligenceServiceClient.PollOnceAnnotateVideoAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AnnotateVideoResponse retrievedResult = retrievedResponse.Result;
}

AnnotateVideoAsync(String, IEnumerable<Feature>, CallSettings)

public virtual Task<Operation<AnnotateVideoResponse, AnnotateVideoProgress>> AnnotateVideoAsync(string inputUri, IEnumerable<Feature> features, CallSettings callSettings = null)

Performs asynchronous video annotation. Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains AnnotateVideoProgress (progress). Operation.response contains AnnotateVideoResponse (results).

Parameters
NameDescription
inputUriString

Input video location. Currently, only Cloud Storage URIs are supported. URIs must be specified in the following format: gs://bucket-id/object-id (other URI formats return [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see Request URIs. To identify multiple videos, a video URI may include wildcards in the object-id. Supported wildcards: '*' to match 0 or more characters; '?' to match 1 character. If unset, the input video should be embedded in the request as input_content. If set, input_content must be unset.

featuresIEnumerable<Feature>

Required. Requested video annotation features.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<AnnotateVideoResponse, AnnotateVideoProgress>>

A Task containing the RPC response.

Example
// Create client
VideoIntelligenceServiceClient videoIntelligenceServiceClient = await VideoIntelligenceServiceClient.CreateAsync();
// Initialize request argument(s)
string inputUri = "";
IEnumerable<Feature> features = new Feature[]
{
    Feature.Unspecified,
};
// Make the request
Operation<AnnotateVideoResponse, AnnotateVideoProgress> response = await videoIntelligenceServiceClient.AnnotateVideoAsync(inputUri, features);

// Poll until the returned long-running operation is complete
Operation<AnnotateVideoResponse, AnnotateVideoProgress> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
AnnotateVideoResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AnnotateVideoResponse, AnnotateVideoProgress> retrievedResponse = await videoIntelligenceServiceClient.PollOnceAnnotateVideoAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AnnotateVideoResponse retrievedResult = retrievedResponse.Result;
}

AnnotateVideoAsync(String, IEnumerable<Feature>, CancellationToken)

public virtual Task<Operation<AnnotateVideoResponse, AnnotateVideoProgress>> AnnotateVideoAsync(string inputUri, IEnumerable<Feature> features, CancellationToken cancellationToken)

Performs asynchronous video annotation. Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains AnnotateVideoProgress (progress). Operation.response contains AnnotateVideoResponse (results).

Parameters
NameDescription
inputUriString

Input video location. Currently, only Cloud Storage URIs are supported. URIs must be specified in the following format: gs://bucket-id/object-id (other URI formats return [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see Request URIs. To identify multiple videos, a video URI may include wildcards in the object-id. Supported wildcards: '*' to match 0 or more characters; '?' to match 1 character. If unset, the input video should be embedded in the request as input_content. If set, input_content must be unset.

featuresIEnumerable<Feature>

Required. Requested video annotation features.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<AnnotateVideoResponse, AnnotateVideoProgress>>

A Task containing the RPC response.

Example
// Create client
VideoIntelligenceServiceClient videoIntelligenceServiceClient = await VideoIntelligenceServiceClient.CreateAsync();
// Initialize request argument(s)
string inputUri = "";
IEnumerable<Feature> features = new Feature[]
{
    Feature.Unspecified,
};
// Make the request
Operation<AnnotateVideoResponse, AnnotateVideoProgress> response = await videoIntelligenceServiceClient.AnnotateVideoAsync(inputUri, features);

// Poll until the returned long-running operation is complete
Operation<AnnotateVideoResponse, AnnotateVideoProgress> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
AnnotateVideoResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AnnotateVideoResponse, AnnotateVideoProgress> retrievedResponse = await videoIntelligenceServiceClient.PollOnceAnnotateVideoAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AnnotateVideoResponse retrievedResult = retrievedResponse.Result;
}

Create()

public static VideoIntelligenceServiceClient Create()

Synchronously creates a VideoIntelligenceServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use VideoIntelligenceServiceClientBuilder.

Returns
TypeDescription
VideoIntelligenceServiceClient

The created VideoIntelligenceServiceClient.

CreateAsync(CancellationToken)

public static Task<VideoIntelligenceServiceClient> CreateAsync(CancellationToken cancellationToken = default(CancellationToken))

Asynchronously creates a VideoIntelligenceServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use VideoIntelligenceServiceClientBuilder.

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
Task<VideoIntelligenceServiceClient>

The task representing the created VideoIntelligenceServiceClient.

PollOnceAnnotateVideo(String, CallSettings)

public virtual Operation<AnnotateVideoResponse, AnnotateVideoProgress> PollOnceAnnotateVideo(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of AnnotateVideo.

Parameters
NameDescription
operationNameString

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<AnnotateVideoResponse, AnnotateVideoProgress>

The result of polling the operation.

PollOnceAnnotateVideoAsync(String, CallSettings)

public virtual Task<Operation<AnnotateVideoResponse, AnnotateVideoProgress>> PollOnceAnnotateVideoAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of AnnotateVideo.

Parameters
NameDescription
operationNameString

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<AnnotateVideoResponse, AnnotateVideoProgress>>

A task representing the result of polling the operation.

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
TypeDescription
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.