Fixed all underlying issues with the "Answer" call.
This commit is contained in:
@@ -45,9 +45,14 @@ public class ServerAPI
|
||||
return offer;
|
||||
}
|
||||
|
||||
public static async Task<Uri> PostAnswerAsync(DBOffer answer)
|
||||
public static async Task<Uri?> PostAnswerAsync(DBOffer answer)
|
||||
{
|
||||
HttpResponseMessage response = await client.PostAsJsonAsync("api/rtc/answer", answer);
|
||||
var body = await response.Content.ReadAsStringAsync();
|
||||
|
||||
Console.WriteLine("PostAnswerAsync status: " + response.StatusCode);
|
||||
Console.WriteLine("PostAnswerAsync body: " + body);
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
return response.Headers.Location;
|
||||
}
|
||||
@@ -94,6 +99,18 @@ public class ServerAPI
|
||||
return response.Headers.Location;
|
||||
}
|
||||
|
||||
public static async Task<RtcDescription?> GetAnswerForChannelAsync(string? channelId)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(channelId))
|
||||
return null;
|
||||
|
||||
HttpResponseMessage response = await client.GetAsync($"api/rtc/answer/{channelId}");
|
||||
if (!response.IsSuccessStatusCode)
|
||||
return null;
|
||||
|
||||
var json = await response.Content.ReadAsStringAsync();
|
||||
return JsonSerializer.Deserialize<RtcDescription>(json);
|
||||
}
|
||||
}
|
||||
|
||||
public class RtcDescription
|
||||
|
||||
Reference in New Issue
Block a user