Process procedure

Official Content

Sends a video to be processed in order to be analyzed later by Analyze procedure. This task is performed asynchronously due to the processing latency.

Parameters

Configuration

The following table resumes the configuration properties that you must set before calling this AI task.

Property   Google Cloud AI IBM Watson  Microsoft Azure  SAP Leonardo
Key From Video Intelligence API  From Video Indexer   -
Account   - From Azure Connect  -

Sample

This section describes two alternatives for processing a video: synchronously or asynchronously. Once processed, you can get the analysis made by the provider. In other words, you need to use both Process and Analyze tasks.

Synchronous processing

The way you process a video synchronously is by polling for the processing status. The example below shows how you can do it.

&callbackObject = "" // It's not necessary to indicate a callback object for this strategy
&VideoId = GeneXusAI.Video.Process(&video,&locale,&callbackObject,&Messages) 
if &Messages.Count > 0 
  <process_errors>
else
   do while True
      &outputAnalysis = GeneXusAI.Video.Analyze(&videoId,&provider,&Messages) // Polling
      if &outputAnalysis.Completed OR &Messages.Count > 0 
         exit // Exit from the loop
      endIf
     &x = Sleep(30) // Wait 30 seconds until poll again
   endDo
   if &Messages.Count > 0
       <process_errors> 
   else
       <analyze_result>
   endIf
endIf

Note that for large video files this strategy may take a long time. Consider using asynchronous strategy in these cases.

Asynchronous processing

The way you process a video asynchronously is by indicating a callback-object to this task.

For example, you can write a code as follows:

&callbackObject = VideoHandler.link("") // It gets the object name mantaining a reference to it
&VideoId = GeneXusAI.Video.Process(&video,&locale,&callbackObject,&Messages)
if &Messages.Count > 0
   <process_errors>
endIf

Where VideoHandler is a Procedure object defined as follows:

Rules:
   parm(in:&videoId); // Mandatory :: video identifier
Source:
   &provider = <your_provider_settings>
   &OutputAnalysis = GeneXusAI.Video.Analyze(&videoId,&provider,&Messages)
   if &Messages.Count > 0
       <process_errors>
   else
       <analyze_result>
   endIf

Alternatively, instead of getting the analysis in this object, you can send a notification and call the Analyze procedure on a Panel for Web or Smart Devices. This can be done by using Server.Socket external object for Web, or Notification Provider API for Smart Devices.

Warning: For testing your asynchronous solution, your application must be accessible for the external provider (e.g. your IP must be remotely accessible, or you can host your application on a real server -- Deploy To Cloud option can be a good alternative).

Notes

  • For the asynchronous strategy, the callback-object must include a Parm rule with the incoming video identifier.

    parm(in:&videoId);

    Where &videoId is a VarChar(128) variable.

  • To get the Key/Account for use MS Cognitive Services, please refer to Note section of this document.

Scope

Platforms  Web(.NET,.NETCore,Java), SmartDevices(Android,iOS)
Connectivity  Online

Availability

This procedure is available as of GeneXus 16 upgrade 1.

See also

Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.