Module: Google::Cloud::VideoIntelligence::V1
- Defined in:
- lib/google/cloud/video_intelligence/v1.rb,
lib/google/cloud/video_intelligence/v1/credentials.rb,
lib/google/cloud/video_intelligence/v1/doc/overview.rb,
lib/google/cloud/video_intelligence/v1/video_intelligence_service_client.rb
Overview
Ruby Client for Cloud Video Intelligence API (GA)
Cloud Video Intelligence API: Cloud Video Intelligence API.
Quick Start
In order to use this library, you first need to go through the following steps:
- Select or create a Cloud Platform project.
- Enable billing for your project.
- Enable the Cloud Video Intelligence API.
- Setup Authentication.
Installation
$ gem install google-cloud-video_intelligence
Preview
VideoIntelligenceServiceClient
require "google/cloud/video_intelligence"
video_intelligence_service_client = Google::Cloud::VideoIntelligence.new(version: :v1)
input_uri = "gs://demomaker/cat.mp4"
features_element = :LABEL_DETECTION
features = [features_element]
# Register a callback during the method call.
operation = video_intelligence_service_client.annotate_video(input_uri: input_uri, features: features) do |op|
raise op.results.message if op.error?
op_results = op.results
# Process the results.
metadata = op.metadata
# Process the metadata.
end
# Or use the return value to register a callback.
operation.on_done do |op|
raise op.results.message if op.error?
op_results = op.results
# Process the results.
metadata = op.metadata
# Process the metadata.
end
# Manually reload the operation.
operation.reload!
# Or block until the operation completes, triggering callbacks on
# completion.
operation.wait_until_done!
Next Steps
- Read the Cloud Video Intelligence API Product documentation to learn more about the product and see How-to Guides.
- View this repository's main README to see the full list of Cloud APIs that we cover.
Enabling Logging
To enable logging for this library, set the logger for the underlying gRPC library.
The logger that you set may be a Ruby stdlib Logger
as shown below,
or a Google::Cloud::Logging::Logger
that will write logs to Stackdriver Logging. See grpc/logconfig.rb
and the gRPC spec_helper.rb for additional information.
Configuring a Ruby stdlib logger:
require "logger"
module MyLogger
LOGGER = Logger.new $stderr, level: Logger::WARN
def logger
LOGGER
end
end
# Define a gRPC module-level logger method before grpc/logconfig.rb loads.
module GRPC
extend MyLogger
end
Defined Under Namespace
Classes: Credentials, VideoIntelligenceServiceClient
Class Method Summary collapse
-
.new(credentials: nil, scopes: nil, client_config: nil, timeout: nil, metadata: nil, exception_transformer: nil, lib_name: nil, lib_version: nil) ⇒ Object
Service that implements Google Cloud Video Intelligence API.
Class Method Details
.new(credentials: nil, scopes: nil, client_config: nil, timeout: nil, metadata: nil, exception_transformer: nil, lib_name: nil, lib_version: nil) ⇒ Object
Service that implements Google Cloud Video Intelligence API.
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/google/cloud/video_intelligence/v1.rb', line 152 def self.new \ credentials: nil, scopes: nil, client_config: nil, timeout: nil, metadata: nil, exception_transformer: nil, lib_name: nil, lib_version: nil kwargs = { credentials: credentials, scopes: scopes, client_config: client_config, timeout: timeout, metadata: , exception_transformer: exception_transformer, lib_name: lib_name, lib_version: lib_version }.select { |_, v| v != nil } Google::Cloud::VideoIntelligence::V1::VideoIntelligenceServiceClient.new(**kwargs) end |