Class: RunApi::Runway::Resources::ExtendVideo

Inherits:
Object
  • Object
show all
Includes:
Core::ResourceHelpers
Defined in:
lib/runapi/runway/resources/extend_video.rb

Overview

Runway extend-video resource. Append additional footage to a previously generated video, continuing from where the source task left off.

Constant Summary collapse

ENDPOINT =
"/api/v1/runway/extend_video"
RESPONSE_CLASS =
Types::TaskCreateResponse
COMPLETED_RESPONSE_CLASS =
Types::CompletedTaskResponse

Instance Method Summary collapse

Constructor Details

#initialize(http) ⇒ ExtendVideo

Returns a new instance of ExtendVideo.



15
16
17
# File 'lib/runapi/runway/resources/extend_video.rb', line 15

def initialize(http)
  @http = http
end

Instance Method Details

#create(**params) ⇒ RunApi::Runway::Types::TaskCreateResponse

Create an extend-video task without waiting for completion.

Parameters:

  • params (Hash)

    extend-video parameters (see #run for details)

Returns:



36
37
38
39
40
# File 'lib/runapi/runway/resources/extend_video.rb', line 36

def create(**params)
  params = compact_params(params)
  validate_params!(params)
  request(:post, ENDPOINT, body: params)
end

#get(id) ⇒ RunApi::Runway::Types::TaskResponse

Get extend-video task status by task ID.

Parameters:

  • id (String)

    task ID

Returns:



46
47
48
# File 'lib/runapi/runway/resources/extend_video.rb', line 46

def get(id)
  request(:get, "#{ENDPOINT}/#{id}")
end

#run(**params) ⇒ RunApi::Runway::Types::CompletedTaskResponse

Extend a video and wait until complete.

Parameters:

  • source_task_id (String)

    ID of the completed TextToVideo or ExtendVideo task to continue from

  • prompt (String)

    prompt describing the continuation footage

  • output_resolution (String)

    must match the resolution of the source task (ā€œ720pā€ or ā€œ1080pā€)

  • watermark (String, nil)

    watermark text burned into the output

  • callback_url (String, nil)

    webhook URL for completion notification

Returns:



27
28
29
30
# File 'lib/runapi/runway/resources/extend_video.rb', line 27

def run(**params)
  task = create(**params)
  poll_until_complete { get(task.id) }
end