diff --git a/BlazorHelloWorld/Components/Pages/Home.razor b/BlazorHelloWorld/Components/Pages/Home.razor
index 3655ef0..c10a73a 100644
--- a/BlazorHelloWorld/Components/Pages/Home.razor
+++ b/BlazorHelloWorld/Components/Pages/Home.razor
@@ -23,17 +23,32 @@
+
+
+
+
@code {
+ private bool isArchiving => this.archiveId != Guid.Empty;
+ private SessionCredentials session;
+ private Guid archiveId;
+
protected override async Task OnAfterRenderAsync(bool firstRender)
{
await base.OnAfterRenderAsync(firstRender);
if (firstRender)
{
- var session = Service.CreateSession();
- await JavascriptRuntime.InvokeVoidAsync("initializeStream", Service.GetApiKey(), session.SessionId, session.Token);
+ this.session = Service.CreateSession();
+ await JavascriptRuntime.InvokeVoidAsync("initializeStream", Service.GetOpenTokId(), session.SessionId, session.Token);
}
}
+ private async Task StartArchiving()
+ {
+ var archive = await Service.StartArchiving(this.session.SessionId);
+ this.archiveId = archive.Id;
+ }
+
+ private Task StopArchiving() => Service.StopArchiving(this.archiveId.ToString());
}
\ No newline at end of file
diff --git a/BlazorHelloWorld/Infrastructure/VideoService.cs b/BlazorHelloWorld/Infrastructure/VideoService.cs
index 76982b8..fdb5a5c 100644
--- a/BlazorHelloWorld/Infrastructure/VideoService.cs
+++ b/BlazorHelloWorld/Infrastructure/VideoService.cs
@@ -10,11 +10,28 @@ namespace BlazorHelloWorld.Infrastructure;
public class VideoService
{
private readonly OpenTok openTok;
+ private readonly string apiKey;
public VideoService(OpenTokOptions options)
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
- openTok = new OpenTok(Convert.ToInt32(options.ApiKey), options.ApiSecret);
+ this.openTok = InitializeClient(options);
+ }
+
+ private OpenTok InitializeClient(OpenTokOptions options)
+ {
+ if (!string.IsNullOrEmpty(options.ApplicationId) && !string.IsNullOrEmpty(options.PrivateKey))
+ {
+ return new OpenTok(options.ApplicationId, options.PrivateKey);
+ }
+
+ if (!string.IsNullOrEmpty(options.ApiKey) && !string.IsNullOrEmpty(options.ApiSecret)
+ && int.TryParse(options.ApiKey, out var key))
+ {
+ return new OpenTok(key, options.ApiSecret);
+ }
+
+ throw new ArgumentException("Missing credentials");
}
public SessionCredentials CreateSession()
@@ -23,12 +40,19 @@ public SessionCredentials CreateSession()
return new SessionCredentials(session.Id, session.GenerateToken());
}
- public int GetApiKey()
+ public string GetOpenTokId() => this.openTok.GetOpenTokId();
+
+ public async Task StartArchiving(string sessionId)
+ {
+ return await openTok.StartArchiveAsync(sessionId);
+ }
+
+ public async Task StopArchiving(string archiveId)
{
- return openTok.ApiKey;
+ await openTok.StopArchiveAsync(archiveId);
}
}
-public record OpenTokOptions(string ApiKey, string ApiSecret);
+public record OpenTokOptions(string ApiKey, string ApiSecret, string ApplicationId, string PrivateKey);
public record SessionCredentials(string SessionId, string Token);
\ No newline at end of file
diff --git a/BlazorHelloWorld/Program.cs b/BlazorHelloWorld/Program.cs
index ae3b2f8..ecbae3a 100644
--- a/BlazorHelloWorld/Program.cs
+++ b/BlazorHelloWorld/Program.cs
@@ -5,7 +5,7 @@
var options = builder.Configuration.GetSection(nameof(OpenTokOptions)).Get();
builder.Services.AddRazorComponents().AddInteractiveServerComponents();
builder.Services.AddServerSideBlazor();
-builder.Services.AddSingleton(options);
+builder.Services.AddSingleton(options);
builder.Services.AddScoped();
var app = builder.Build();
app.UseHttpsRedirection();
diff --git a/BlazorHelloWorld/appsettings.json b/BlazorHelloWorld/appsettings.json
index cf094c1..bbee824 100644
--- a/BlazorHelloWorld/appsettings.json
+++ b/BlazorHelloWorld/appsettings.json
@@ -8,6 +8,8 @@
"AllowedHosts": "*",
"OpenTokOptions": {
"ApiKey": "",
- "ApiSecret": ""
+ "ApiSecret": "",
+ "ApplicationId": "",
+ "PrivateKey": ""
}
}
diff --git a/OpenTok/OpenTok.AudioConnector.cs b/OpenTok/OpenTok.AudioConnector.cs
index 2544b90..809d2f1 100644
--- a/OpenTok/OpenTok.AudioConnector.cs
+++ b/OpenTok/OpenTok.AudioConnector.cs
@@ -14,7 +14,7 @@ public partial class OpenTok
public async Task StartAudioConnectorAsync(AudioConnectorStartRequest request)
{
var response = await this.Client.PostAsync(
- $"v2/project/{this.ApiKey}/connect",
+ $"v2/project/{this.GetOpenTokId()}/connect",
GetHeaderDictionary("application/json"),
request.ToDataDictionary());
return JsonConvert.DeserializeObject(response);
@@ -26,7 +26,7 @@ public async Task StartAudioConnectorAsync(AudioConnectorStartRe
/// The OpenTok connection ID for the Audio Connector WebSocket connection in the OpenTok session. See .
public async Task StopAudioConnectorAsync(string connectionId) =>
_ = await this.Client.PostAsync(
- $"v2/project/{this.ApiKey}/connect/{connectionId}/stop",
+ $"v2/project/{this.GetOpenTokId()}/connect/{connectionId}/stop",
new Dictionary(),
new Dictionary());
}
diff --git a/OpenTok/OpenTok.Render.cs b/OpenTok/OpenTok.Render.cs
index 9d02cab..462ddc8 100644
--- a/OpenTok/OpenTok.Render.cs
+++ b/OpenTok/OpenTok.Render.cs
@@ -59,7 +59,7 @@ await this.Client.DeleteAsync(
this.BuildUrlWithRouteParameter(RenderEndpoint, renderId),
new Dictionary());
- private string BuildUrl(string endpoint) => $"v2/project/{this.ApiKey}{endpoint}";
+ private string BuildUrl(string endpoint) => $"v2/project/{this.GetOpenTokId()}{endpoint}";
private string BuildUrlWithQueryParameter(string endpoint, string queryParameter) =>
$"{this.BuildUrl(endpoint)}?{queryParameter}";
diff --git a/OpenTok/OpenTok.cs b/OpenTok/OpenTok.cs
index 9a348a7..2eb7c0e 100644
--- a/OpenTok/OpenTok.cs
+++ b/OpenTok/OpenTok.cs
@@ -54,6 +54,10 @@ public partial class OpenTok
"1080x1920"
};
+ private readonly string applicationId;
+ private readonly string privateKey;
+ private bool IsShim => !string.IsNullOrEmpty(applicationId);
+
///
/// Enables writing request/response details to console.
@@ -97,6 +101,20 @@ public OpenTok(int apiKey, string apiSecret, string apiUrl)
Client = new HttpClient(apiKey, apiSecret, OpenTokServer);
Debug = false;
}
+
+ ///
+ /// Use for OpenTok to target Vonage Video API
+ ///
+ /// The application Id.
+ /// The private key.
+ public OpenTok(string applicationId, string privateKey)
+ {
+ this.applicationId = applicationId;
+ this.privateKey = privateKey;
+ OpenTokServer = "https://api.opentok.com";
+ Client = new HttpClient(applicationId, privateKey);
+ Debug = false;
+ }
///
/// Creates a new OpenTok session.
@@ -220,8 +238,10 @@ public Session CreateSession(
throw new OpenTokWebException("Session could not be provided. Are ApiKey and ApiSecret correctly set?");
}
var sessionId = xmlDoc.GetElementsByTagName("session_id")[0].ChildNodes[0].Value;
- var apiKey = Convert.ToInt32(xmlDoc.GetElementsByTagName("partner_id")[0].ChildNodes[0].Value);
- return new Session(sessionId, apiKey, ApiSecret, location, mediaMode, archiveMode);
+
+ return this.IsShim
+ ? Session.FromShim(sessionId, this.applicationId, this.privateKey, location, mediaMode, archiveMode)
+ : Session.FromLegacy(sessionId, Convert.ToInt32(xmlDoc.GetElementsByTagName("partner_id")[0].ChildNodes[0].Value), ApiSecret, location, mediaMode, archiveMode);
}
///
@@ -342,8 +362,9 @@ public async Task CreateSessionAsync(string location = "", MediaMode me
throw new OpenTokWebException("Session could not be provided. Are ApiKey and ApiSecret correctly set?");
}
var sessionId = xmlDoc.GetElementsByTagName("session_id")[0].ChildNodes[0].Value;
- var apiKey = Convert.ToInt32(xmlDoc.GetElementsByTagName("partner_id")[0].ChildNodes[0].Value);
- return new Session(sessionId, apiKey, ApiSecret, location, mediaMode, archiveMode);
+ return this.IsShim
+ ? Session.FromShim(sessionId, this.applicationId, this.privateKey, location, mediaMode, archiveMode)
+ : Session.FromLegacy(sessionId, Convert.ToInt32(xmlDoc.GetElementsByTagName("partner_id")[0].ChildNodes[0].Value), ApiSecret, location, mediaMode, archiveMode);
}
///
@@ -393,8 +414,16 @@ public string GenerateToken(string sessionId, Role role = Role.PUBLISHER, double
throw new OpenTokArgumentException("Invalid Session id " + sessionId);
}
- Session session = new Session(sessionId, ApiKey, ApiSecret);
- return session.GenerateToken(role, expireTime, data, initialLayoutClassList);
+ return new TokenGenerator().GenerateSessionToken(new TokenData()
+ {
+ ApiSecret = this.ApiSecret,
+ Role = role,
+ ApiKey = this.ApiKey.ToString(),
+ Data = data,
+ SessionId = sessionId,
+ ExpireTime = expireTime,
+ InitialLayoutClasses = initialLayoutClassList ?? Enumerable.Empty(),
+ });
}
///
@@ -444,6 +473,7 @@ public string GenerateT1Token(string sessionId, Role role = Role.PUBLISHER, doub
throw new OpenTokArgumentException("Invalid Session id " + sessionId);
}
+
Session session = new Session(sessionId, ApiKey, ApiSecret);
return session.GenerateT1Token(role, expireTime, data, initialLayoutClassList);
}
@@ -520,7 +550,7 @@ public Archive StartArchive(string sessionId, string name = "", bool hasVideo =
{
throw new OpenTokArgumentException("Session not valid");
}
- string url = $"v2/project/{ApiKey}/archive";
+ string url = $"v2/project/{this.GetOpenTokId()}/archive";
var headers = new Dictionary { { "Content-Type", "application/json" } };
var data = new Dictionary { { "sessionId", sessionId }, { "name", name }, { "hasVideo", hasVideo }, { "hasAudio", hasAudio }, { "outputMode", outputMode.ToString().ToLowerInvariant() } };
@@ -563,6 +593,12 @@ public Archive StartArchive(string sessionId, string name = "", bool hasVideo =
return OpenTokUtils.GenerateArchive(response, ApiKey, ApiSecret, OpenTokServer);
}
+ ///
+ /// Retrieves either the Api Key or Application Id associated with the OpenTok object.
+ ///
+ /// The identifier.
+ public string GetOpenTokId() => this.IsShim ? this.applicationId : this.ApiKey.ToString();
+
///
/// Starts archiving an OpenTok session.
///
@@ -635,7 +671,7 @@ public async Task StartArchiveAsync(string sessionId, string name = "",
{
throw new OpenTokArgumentException("Session not valid");
}
- string url = $"v2/project/{ApiKey}/archive";
+ string url = $"v2/project/{this.GetOpenTokId()}/archive";
var headers = new Dictionary { { "Content-Type", "application/json" } };
var data = new Dictionary
{
@@ -696,7 +732,7 @@ public async Task StartArchiveAsync(string sessionId, string name = "",
/// The Archive object corresponding to the archive being stopped.
public Archive StopArchive(string archiveId)
{
- string url = string.Format("v2/project/{0}/archive/{1}/stop", ApiKey, archiveId);
+ string url = string.Format("v2/project/{0}/archive/{1}/stop", this.GetOpenTokId(), archiveId);
var headers = new Dictionary { { "Content-Type", "application/json" } };
string response = Client.Post(url, headers, new Dictionary());
@@ -714,7 +750,7 @@ public Archive StopArchive(string archiveId)
/// The Archive object corresponding to the archive being stopped.
public async Task StopArchiveAsync(string archiveId)
{
- string url = $"v2/project/{ApiKey}/archive/{archiveId}/stop";
+ string url = $"v2/project/{this.GetOpenTokId()}/archive/{archiveId}/stop";
var headers = new Dictionary { { "Content-Type", "application/json" } };
string response = await Client.PostAsync(url, headers, new Dictionary());
@@ -742,7 +778,7 @@ public ArchiveList ListArchives(int offset = 0, int count = 0, string sessionId
{
throw new OpenTokArgumentException("count cannot be smaller than 0");
}
- string url = $"v2/project/{ApiKey}/archive?offset={offset}";
+ string url = $"v2/project/{this.GetOpenTokId()}/archive?offset={offset}";
if (count > 0)
{
@@ -785,7 +821,7 @@ public async Task ListArchivesAsync(int offset = 0, int count = 0,
throw new OpenTokArgumentException("count cannot be smaller than 0");
}
- string url = $"v2/project/{this.ApiKey}/archive?offset={offset}";
+ string url = $"v2/project/{this.GetOpenTokId()}/archive?offset={offset}";
if (count > 0)
{
url = $"{url}&count={count}";
@@ -813,7 +849,7 @@ public async Task ListArchivesAsync(int offset = 0, int count = 0,
/// The object.
public Archive GetArchive(string archiveId)
{
- string url = $"v2/project/{ApiKey}/archive/{archiveId}";
+ string url = $"v2/project/{this.GetOpenTokId()}/archive/{archiveId}";
string response = Client.Get(url);
return JsonConvert.DeserializeObject(response);
}
@@ -825,7 +861,7 @@ public Archive GetArchive(string archiveId)
/// The object.
public async Task GetArchiveAsync(string archiveId)
{
- string url = $"v2/project/{ApiKey}/archive/{archiveId}";
+ string url = $"v2/project/{this.GetOpenTokId()}/archive/{archiveId}";
string response = await Client.GetAsync(url, null);
return JsonConvert.DeserializeObject(response);
}
@@ -841,7 +877,7 @@ public async Task GetArchiveAsync(string archiveId)
/// The archive ID of the archive you want to delete.
public void DeleteArchive(string archiveId)
{
- string url = $"v2/project/{ApiKey}/archive/{archiveId}";
+ string url = $"v2/project/{this.GetOpenTokId()}/archive/{archiveId}";
var headers = new Dictionary();
Client.Delete(url, headers);
}
@@ -857,7 +893,7 @@ public void DeleteArchive(string archiveId)
/// The archive ID of the archive you want to delete.
public Task DeleteArchiveAsync(string archiveId)
{
- string url = $"v2/project/{ApiKey}/archive/{archiveId}";
+ string url = $"v2/project/{this.GetOpenTokId()}/archive/{archiveId}";
var headers = new Dictionary();
return Client.DeleteAsync(url, headers);
}
@@ -885,7 +921,7 @@ public void AddStreamToArchive(string archiveId, string streamId, bool hasAudio
throw new OpenTokArgumentException("The streamId cannot be null or empty");
}
- string url = $"v2/project/{ApiKey}/archive/{archiveId}/streams";
+ string url = $"v2/project/{this.GetOpenTokId()}/archive/{archiveId}/streams";
var headers = new Dictionary { { "Content-Type", "application/json" } };
var data = new Dictionary
{
@@ -920,7 +956,7 @@ public Task AddStreamToArchiveAsync(string archiveId, string streamId, bool hasA
throw new OpenTokArgumentException("The streamId cannot be null or empty");
}
- string url = $"v2/project/{ApiKey}/archive/{archiveId}/streams";
+ string url = $"v2/project/{this.GetOpenTokId()}/archive/{archiveId}/streams";
var headers = new Dictionary { { "Content-Type", "application/json" } };
var data = new Dictionary
{
@@ -950,7 +986,7 @@ public void RemoveStreamFromArchive(string archiveId, string streamId)
throw new OpenTokArgumentException("The streamId cannot be null or empty");
}
- string url = $"v2/project/{ApiKey}/archive/{archiveId}/streams";
+ string url = $"v2/project/{this.GetOpenTokId()}/archive/{archiveId}/streams";
var headers = new Dictionary { { "Content-Type", "application/json" } };
var data = new Dictionary { { "removeStream", streamId } };
@@ -975,7 +1011,7 @@ public Task RemoveStreamFromArchiveAsync(string archiveId, string streamId)
throw new OpenTokArgumentException("The streamId cannot be null or empty");
}
- string url = $"v2/project/{ApiKey}/archive/{archiveId}/streams";
+ string url = $"v2/project/{this.GetOpenTokId()}/archive/{archiveId}/streams";
var headers = new Dictionary { { "Content-Type", "application/json" } };
var data = new Dictionary { { "removeStream", streamId } };
@@ -1000,7 +1036,7 @@ public Stream GetStream(string sessionId, string streamId)
throw new OpenTokArgumentException("The streamId cannot be null or empty", nameof(streamId));
}
- string url = $"v2/project/{ApiKey}/session/{sessionId}/stream/{streamId}";
+ string url = $"v2/project/{this.GetOpenTokId()}/session/{sessionId}/stream/{streamId}";
string response = Client.Get(url);
Stream stream = JsonConvert.DeserializeObject(response);
Stream streamCopy = new Stream();
@@ -1026,7 +1062,7 @@ public async Task GetStreamAsync(string sessionId, string streamId)
throw new OpenTokArgumentException("The streamId cannot be null or empty", nameof(streamId));
}
- string url = $"v2/project/{ApiKey}/session/{sessionId}/stream/{streamId}";
+ string url = $"v2/project/{this.GetOpenTokId()}/session/{sessionId}/stream/{streamId}";
string response = await Client.GetAsync(url);
Stream stream = JsonConvert.DeserializeObject(response);
Stream streamCopy = new Stream();
@@ -1047,7 +1083,7 @@ public StreamList ListStreams(string sessionId)
{
throw new OpenTokArgumentException("The sessionId cannot be null or empty", nameof(sessionId));
}
- string url = $"v2/project/{ApiKey}/session/{sessionId}/stream";
+ string url = $"v2/project/{this.GetOpenTokId()}/session/{sessionId}/stream";
string response = Client.Get(url);
JObject streams = JObject.Parse(response);
JArray streamsArray = (JArray)streams["items"];
@@ -1068,7 +1104,7 @@ public async Task ListStreamsAsync(string sessionId)
{
throw new OpenTokArgumentException("The sessionId cannot be null or empty", nameof(sessionId));
}
- string url = $"v2/project/{ApiKey}/session/{sessionId}/stream";
+ string url = $"v2/project/{this.GetOpenTokId()}/session/{sessionId}/stream";
string response = await Client.GetAsync(url);
JObject streams = JObject.Parse(response);
JArray streamsArray = (JArray)streams["items"];
@@ -1097,7 +1133,7 @@ public void ForceDisconnect(string sessionId, string connectionId)
{
throw new OpenTokArgumentException("Invalid session Id", nameof(sessionId));
}
- string url = $"v2/project/{ApiKey}/session/{sessionId}/connection/{connectionId}";
+ string url = $"v2/project/{this.GetOpenTokId()}/session/{sessionId}/connection/{connectionId}";
var headers = new Dictionary();
Client.Delete(url, headers);
}
@@ -1123,7 +1159,7 @@ public async Task ForceDisconnectAsync(string sessionId, string connectionId)
{
throw new OpenTokArgumentException("Invalid session Id", nameof(sessionId));
}
- string url = $"v2/project/{ApiKey}/session/{sessionId}/connection/{connectionId}";
+ string url = $"v2/project/{this.GetOpenTokId()}/session/{sessionId}/connection/{connectionId}";
var headers = new Dictionary();
await Client.DeleteAsync(url, headers);
}
@@ -1191,7 +1227,7 @@ public Broadcast StartBroadcast(string sessionId, bool hls = true, List rt
int maxDuration = 7200, BroadcastLayout layout = null, StreamMode? streamMode = null, bool dvr = false, bool? lowLatency = null, string multiBroadcastTag = null, bool hasAudio = true, bool hasVideo = true)
{
var data = PrepareStartBroadcastData(sessionId, hls, rtmpList, resolution, maxDuration, layout, streamMode, dvr, lowLatency, multiBroadcastTag, hasAudio, hasVideo);
- string url = $"v2/project/{ApiKey}/broadcast";
+ string url = $"v2/project/{this.GetOpenTokId()}/broadcast";
var headers = new Dictionary { { "Content-Type", "application/json" } };
string response = Client.Post(url, headers, data);
return OpenTokUtils.GenerateBroadcast(response, ApiKey, ApiSecret, OpenTokServer);
@@ -1260,7 +1296,7 @@ public async Task StartBroadcastAsync(string sessionId, bool hls = tr
int maxDuration = 7200, BroadcastLayout layout = null, StreamMode? streamMode = null, bool dvr = false, bool? lowLatency = null, string multiBroadcastTag = null, bool hasAudio = true, bool hasVideo = true)
{
var data = PrepareStartBroadcastData(sessionId, hls, rtmpList, resolution, maxDuration, layout, streamMode, dvr, lowLatency, multiBroadcastTag, hasAudio, hasVideo);
- string url = $"v2/project/{ApiKey}/broadcast";
+ string url = $"v2/project/{this.GetOpenTokId()}/broadcast";
var headers = new Dictionary { { "Content-Type", "application/json" } };
string response = await Client.PostAsync(url, headers, data);
return OpenTokUtils.GenerateBroadcast(response, ApiKey, ApiSecret, OpenTokServer);
@@ -1368,7 +1404,7 @@ private Dictionary PrepareStartBroadcastData(string sessionId, b
///
public Broadcast StopBroadcast(string broadcastId)
{
- string url = $"v2/project/{ApiKey}/broadcast/{broadcastId}/stop";
+ string url = $"v2/project/{this.GetOpenTokId()}/broadcast/{broadcastId}/stop";
var headers = new Dictionary { { "Content-Type", "application/json" } };
string response = Client.Post(url, headers, new Dictionary());
return JsonConvert.DeserializeObject(response);
@@ -1388,7 +1424,7 @@ public Broadcast StopBroadcast(string broadcastId)
///
public async Task StopBroadcastAsync(string broadcastId)
{
- string url = $"v2/project/{ApiKey}/broadcast/{broadcastId}/stop";
+ string url = $"v2/project/{this.GetOpenTokId()}/broadcast/{broadcastId}/stop";
var headers = new Dictionary { { "Content-Type", "application/json" } };
string response = await Client.PostAsync(url, headers, new Dictionary());
@@ -1408,7 +1444,7 @@ public async Task StopBroadcastAsync(string broadcastId)
///
public Broadcast GetBroadcast(string broadcastId)
{
- string url = $"v2/project/{ApiKey}/broadcast/{broadcastId}";
+ string url = $"v2/project/{this.GetOpenTokId()}/broadcast/{broadcastId}";
string response = Client.Get(url);
return OpenTokUtils.GenerateBroadcast(response, ApiKey, ApiSecret, OpenTokServer);
}
@@ -1426,7 +1462,7 @@ public Broadcast GetBroadcast(string broadcastId)
///
public async Task GetBroadcastAsync(string broadcastId)
{
- string url = $"v2/project/{ApiKey}/broadcast/{broadcastId}";
+ string url = $"v2/project/{this.GetOpenTokId()}/broadcast/{broadcastId}";
string response = await Client.GetAsync(url);
return OpenTokUtils.GenerateBroadcast(response, ApiKey, ApiSecret, OpenTokServer);
}
@@ -1439,7 +1475,7 @@ public async Task GetBroadcastAsync(string broadcastId)
/// The BroadcastLayout that defines layout options for the broadcast.
public void SetBroadcastLayout(string broadcastId, BroadcastLayout layout)
{
- string url = $"v2/project/{ApiKey}/broadcast/{broadcastId}/layout";
+ string url = $"v2/project/{this.GetOpenTokId()}/broadcast/{broadcastId}/layout";
var headers = new Dictionary { { "Content-Type", "application/json" } };
var data = new Dictionary();
if (layout != null)
@@ -1479,7 +1515,7 @@ public void SetBroadcastLayout(string broadcastId, BroadcastLayout layout)
/// The BroadcastLayout that defines layout options for the broadcast.
public async Task SetBroadcastLayoutAsync(string broadcastId, BroadcastLayout layout)
{
- string url = $"v2/project/{ApiKey}/broadcast/{broadcastId}/layout";
+ string url = $"v2/project/{this.GetOpenTokId()}/broadcast/{broadcastId}/layout";
var headers = new Dictionary { { "Content-Type", "application/json" } };
var data = new Dictionary();
if (layout != null)
@@ -1520,7 +1556,7 @@ public async Task SetBroadcastLayoutAsync(string broadcastId, BroadcastLayout la
///
public bool SetArchiveLayout(string archiveId, ArchiveLayout layout)
{
- string url = $"v2/project/{ApiKey}/archive/{archiveId}/layout";
+ string url = $"v2/project/{this.GetOpenTokId()}/archive/{archiveId}/layout";
var headers = new Dictionary { { "Content-Type", "application/json" } };
var data = new Dictionary();
@@ -1581,7 +1617,7 @@ public void AddStreamToBroadcast(string broadcastId, string streamId, bool hasAu
throw new OpenTokArgumentException("The streamId cannot be null or empty");
}
- string url = $"v2/project/{ApiKey}/broadcast/{broadcastId}/streams";
+ string url = $"v2/project/{this.GetOpenTokId()}/broadcast/{broadcastId}/streams";
var headers = new Dictionary { { "Content-Type", "application/json" } };
var data = new Dictionary
{
@@ -1617,7 +1653,7 @@ public Task AddStreamToBroadcastAsync(string broadcastId, string streamId, bool
throw new OpenTokArgumentException("The streamId cannot be null or empty");
}
- string url = $"v2/project/{ApiKey}/broadcast/{broadcastId}/streams";
+ string url = $"v2/project/{this.GetOpenTokId()}/broadcast/{broadcastId}/streams";
var headers = new Dictionary { { "Content-Type", "application/json" } };
var data = new Dictionary
{
@@ -1648,7 +1684,7 @@ public void RemoveStreamFromBroadcast(string broadcastId, string streamId)
throw new OpenTokArgumentException("The streamId cannot be null or empty");
}
- string url = $"v2/project/{ApiKey}/broadcast/{broadcastId}/streams";
+ string url = $"v2/project/{this.GetOpenTokId()}/broadcast/{broadcastId}/streams";
var headers = new Dictionary { { "Content-Type", "application/json" } };
var data = new Dictionary
{
@@ -1677,7 +1713,7 @@ public Task RemoveStreamFromBroadcastAsync(string broadcastId, string streamId)
throw new OpenTokArgumentException("The streamId cannot be null or empty");
}
- string url = $"v2/project/{ApiKey}/broadcast/{broadcastId}/streams";
+ string url = $"v2/project/{this.GetOpenTokId()}/broadcast/{broadcastId}/streams";
var headers = new Dictionary { { "Content-Type", "application/json" } };
var data = new Dictionary
{
@@ -1697,7 +1733,7 @@ public Task RemoveStreamFromBroadcastAsync(string broadcastId, string streamId)
///
public async Task SetArchiveLayoutAsync(string archiveId, ArchiveLayout layout)
{
- string url = $"v2/project/{ApiKey}/archive/{archiveId}/layout";
+ string url = $"v2/project/{this.GetOpenTokId()}/archive/{archiveId}/layout";
var headers = new Dictionary { { "Content-Type", "application/json" } };
var data = new Dictionary();
@@ -1747,7 +1783,7 @@ public async Task SetArchiveLayoutAsync(string archiveId, ArchiveLayout la
/// A list of StreamsProperties that defines class lists for one or more streams in the session.
public void SetStreamClassLists(string sessionId, List streams)
{
- string url = $"v2/project/{ApiKey}/session/{sessionId}/stream";
+ string url = $"v2/project/{this.GetOpenTokId()}/session/{sessionId}/stream";
var headers = new Dictionary { { "Content-Type", "application/json" } };
var items = new List