CreateImageToVideo

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using var client = new RunwayClient(apiKey);

var response = await client.CreateVideoFromImageAsync(
    xRunwayVersion: CreateVideoFromImageXRunwayVersion.x20240913,
    promptImage: "https://img.freepik.com/free-photo/beautiful-woman-with-long-blond-hair-looking-camera-outdoors-generated-by-artificial-intelligence_188544-240170.jpg",
    seed: 999999999,
    model: CreateVideoFromImageRequestModel.Gen3aTurbo,
    promptText: "The girl smiles a little",
    watermark: false,
    duration: 5,
    ratio: CreateVideoFromImageRequestRatio.x16_9);

GetTaskDetailResponse taskDetail;
do
{
    taskDetail = await client.GetTaskDetailAsync(GetTaskDetailXRunwayVersion.x20240913, response.Id);

    Console.WriteLine($"Progress: {taskDetail.Progress}");

    await Task.Delay(TimeSpan.FromSeconds(10));
}
while (taskDetail.Status != GetTaskDetailResponseStatus.FAILED &&
       taskDetail.Status != GetTaskDetailResponseStatus.SUCCEEDED &&
       taskDetail.Status != GetTaskDetailResponseStatus.CANCELLED);

Console.WriteLine($"Task ID: {taskDetail.Id}");
Console.WriteLine($"Task Status: {taskDetail.Status}");
Console.WriteLine($"CreatedAt: {taskDetail.CreatedAt}");
Console.WriteLine($"Failure: {taskDetail.Failure}");
Console.WriteLine($"FailureCode: {taskDetail.FailureCode}");
Console.WriteLine($"Progress: {taskDetail.Progress}");

foreach (var output in taskDetail.Output ?? [])
{
    Console.WriteLine($"Video URL: {output}");
}