diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index bc08e3b7..d958c034 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -20,13 +20,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
- dotnet-version: |
- 2.0.x
- 2.1.x
- 2.2.x
- 3.1.x
- 5.0.x
- 6.0.x
+ dotnet-version: 6.0.x
- name: Clean
run: dotnet clean OpenTok.sln --configuration ${{ env.CONFIGURATION }} && dotnet nuget locals all --clear
- name: Install dependencies
@@ -34,4 +28,4 @@ jobs:
- name: Build
run: dotnet build OpenTok.sln --configuration ${{ env.CONFIGURATION }} --no-restore
- name: Test
- run: dotnet test OpenTokTest/OpenTokTest.csproj --configuration ${{ env.CONFIGURATION }} --no-build -f netcoreapp3.1
\ No newline at end of file
+ run: dotnet test OpenTokTest/OpenTokTest.csproj --configuration ${{ env.CONFIGURATION }} --no-build
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 2115fb44..7e6c5436 100644
--- a/.gitignore
+++ b/.gitignore
@@ -218,4 +218,7 @@ pip-log.txt
## Samples
#Samples/HelloWorld/App.config
-#Samples/Archiving/App.config
\ No newline at end of file
+#Samples/Archiving/App.config
+
+## Jetbrains IDE
+.idea/
diff --git a/OpenTok/OpenTok.csproj b/OpenTok/OpenTok.csproj
index 02e2fe09..39434d68 100644
--- a/OpenTok/OpenTok.csproj
+++ b/OpenTok/OpenTok.csproj
@@ -1,7 +1,7 @@
- net452;net46;net461;netstandard2.0
+ netstandard2.0
3.11.2
OpenTok is an API from TokBox that enables websites to weave live group video communication into their online experience.
https://github.com/opentok/Opentok-.NET-SDK
@@ -22,32 +22,13 @@
true
true
8
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
diff --git a/OpenTokTest/OpenTokTest.csproj b/OpenTokTest/OpenTokTest.csproj
index 3b9994f9..9df6fd20 100644
--- a/OpenTokTest/OpenTokTest.csproj
+++ b/OpenTokTest/OpenTokTest.csproj
@@ -1,7 +1,7 @@
Vonage
- net452;net46;net461;net462;net47;net471;net472;net48;netcoreapp3.1
+ net481
Vonage
Vonage 2020
OpenTokSDKTest
@@ -286,22 +286,22 @@
-
-
-
+
+
+
+
+
-
-
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
-
-
-
-
-
PreserveNewest
diff --git a/Samples/Archiving/Archiving.csproj b/Samples/Archiving/Archiving.csproj
index b734d7b6..4f75e534 100644
--- a/Samples/Archiving/Archiving.csproj
+++ b/Samples/Archiving/Archiving.csproj
@@ -3,17 +3,17 @@
Archiving
1.0.0
- net452
+ net481
Vonage
Vonage
Copyright © 2020
Exe
-
-
-
-
+
+
+
+
@@ -77,5 +77,8 @@
Always
+
+
+
diff --git a/Samples/Archiving/MainModule.cs b/Samples/Archiving/MainModule.cs
index 6af5403e..d43f5fd7 100644
--- a/Samples/Archiving/MainModule.cs
+++ b/Samples/Archiving/MainModule.cs
@@ -1,91 +1,69 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Dynamic;
-
+using System.Dynamic;
using Nancy;
using OpenTokSDK;
namespace Archiving
{
-
- public class MainModule : NancyModule
- {
-
- public MainModule(OpenTokService opentokService)
- {
-
- Get["/"] = _ => View["index"];
-
- Get["/host"] = _ =>
- {
- dynamic locals = new ExpandoObject();
-
- locals.ApiKey = opentokService.OpenTok.ApiKey.ToString();
- locals.SessionId = opentokService.Session.Id;
- locals.Token = opentokService.Session.GenerateToken();
-
- return View["host", locals];
- };
-
- Get["/participant"] = _ =>
- {
- dynamic locals = new ExpandoObject();
-
- locals.ApiKey = opentokService.OpenTok.ApiKey.ToString();
- locals.SessionId = opentokService.Session.Id;
- locals.Token = opentokService.Session.GenerateToken();
-
- return View["participant", locals];
- };
-
- Get["/history"] = _ =>
- {
- var page = Request.Query.page.HasValue ? (int)Request.Query.page : 1;
- var offset = (page - 1) * 5;
- ArchiveList archives = opentokService.OpenTok.ListArchives(offset, 5);
-
- string showPrevious = page > 1 ? "/history?page=" + (page - 1).ToString() : null;
- string showNext = archives.TotalCount > (offset + 5) ? "/history?page=" + (page + 1).ToString() : null;
-
- dynamic locals = new ExpandoObject();
- locals.Archives = archives;
- locals.ShowPrevious = showPrevious;
- locals.ShowNext = showNext;
-
- return View["history", locals];
- };
-
- Get["/download/{id}"] = parameters =>
- {
- Archive archive = opentokService.OpenTok.GetArchive(parameters.id);
- return Response.AsRedirect(archive.Url);
- };
-
- Post["/start"] = _ =>
- {
- Archive archive = opentokService.OpenTok.StartArchive(
- opentokService.Session.Id,
- name: ".NET Archiving Sample App",
- hasAudio: (Boolean)(this.Request.Form.hasAudio),
- hasVideo: (Boolean)(this.Request.Form.hasVideo),
- outputMode: (this.Request.Form.outputMode == "composed" ? OutputMode.COMPOSED : OutputMode.INDIVIDUAL)
- );
- return archive;
- };
-
- Get["/stop/{id}"] = parameters =>
- {
- Archive archive = opentokService.OpenTok.StopArchive(parameters.id);
- return archive;
- };
-
- Get["/delete/{id}"] = parameters =>
- {
- opentokService.OpenTok.DeleteArchive(parameters.id);
- return Response.AsRedirect("/history");
- };
- }
- }
-}
+ public class MainModule : NancyModule
+ {
+ public MainModule(OpenTokService opentokService)
+ {
+ Get("/", _ => View["index"]);
+ Get("/host", _ =>
+ {
+ dynamic locals = new ExpandoObject();
+ locals.ApiKey = opentokService.OpenTok.ApiKey.ToString();
+ locals.SessionId = opentokService.Session.Id;
+ locals.Token = opentokService.Session.GenerateToken();
+ return View["host", locals];
+ });
+ Get("/participant", _ =>
+ {
+ dynamic locals = new ExpandoObject();
+ locals.ApiKey = opentokService.OpenTok.ApiKey.ToString();
+ locals.SessionId = opentokService.Session.Id;
+ locals.Token = opentokService.Session.GenerateToken();
+ return View["participant", locals];
+ });
+ Get("/history", _ =>
+ {
+ var page = Request.Query.page.HasValue ? (int) Request.Query.page : 1;
+ var offset = (page - 1) * 5;
+ var archives = opentokService.OpenTok.ListArchives(offset, 5);
+ var showPrevious = page > 1 ? "/history?page=" + (page - 1) : null;
+ var showNext = archives.TotalCount > offset + 5 ? "/history?page=" + (page + 1) : null;
+ dynamic locals = new ExpandoObject();
+ locals.Archives = archives;
+ locals.ShowPrevious = showPrevious;
+ locals.ShowNext = showNext;
+ return View["history", locals];
+ });
+ Get("/download/{id}", parameters =>
+ {
+ Archive archive = opentokService.OpenTok.GetArchive(parameters.id);
+ return Response.AsRedirect(archive.Url);
+ });
+ Post("/start", _ =>
+ {
+ var archive = opentokService.OpenTok.StartArchive(
+ opentokService.Session.Id,
+ ".NET Archiving Sample App",
+ hasAudio: (bool) this.Request.Form.hasAudio,
+ hasVideo: (bool) this.Request.Form.hasVideo,
+ outputMode: this.Request.Form.outputMode == "composed" ? OutputMode.COMPOSED : OutputMode.INDIVIDUAL
+ );
+ return archive;
+ });
+ Get("/stop/{id}", parameters =>
+ {
+ Archive archive = opentokService.OpenTok.StopArchive(parameters.id);
+ return archive;
+ });
+ Get("/delete/{id}", parameters =>
+ {
+ opentokService.OpenTok.DeleteArchive(parameters.id);
+ return Response.AsRedirect("/history");
+ });
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Broadcasting/Broadcasting.csproj b/Samples/Broadcasting/Broadcasting.csproj
index bc0f79e9..5391e9a2 100644
--- a/Samples/Broadcasting/Broadcasting.csproj
+++ b/Samples/Broadcasting/Broadcasting.csproj
@@ -3,16 +3,17 @@
Broadcasting
1.0.0
- net452
+ net481
Vonage
Vonage
Copyright © 2020
Exe
-
-
-
-
+
+
+
+
+
diff --git a/Samples/Broadcasting/MainModule.cs b/Samples/Broadcasting/MainModule.cs
index 17354684..cb1d712d 100644
--- a/Samples/Broadcasting/MainModule.cs
+++ b/Samples/Broadcasting/MainModule.cs
@@ -1,129 +1,120 @@
using System;
using System.Collections.Generic;
using System.Dynamic;
-
using Nancy;
using OpenTokSDK;
using OpenTokSDK.Util;
namespace Broadcasting
{
+ public class MainModule : NancyModule
+ {
+ public MainModule(OpenTokService opentokService)
+ {
+ Get("/", _ => View["index"]);
+ Get("/host", _ =>
+ {
+ dynamic locals = new ExpandoObject();
+ locals.ApiKey = opentokService.OpenTok.ApiKey.ToString();
+ locals.SessionId = opentokService.Session.Id;
+ locals.Token =
+ opentokService.Session.GenerateToken(Role.PUBLISHER, 0, null, new List(new[] {"focus"}));
+ locals.InitialBroadcastId = opentokService.broadcastId;
+ locals.FocusStreamId = opentokService.focusStreamId;
+ locals.InitialLayout = OpenTokUtils.convertToCamelCase(opentokService.layout.ToString());
+ return View["host", locals];
+ });
+ Get("/participant", _ =>
+ {
+ dynamic locals = new ExpandoObject();
+ locals.ApiKey = opentokService.OpenTok.ApiKey.ToString();
+ locals.SessionId = opentokService.Session.Id;
+ locals.Token = opentokService.Session.GenerateToken();
+ locals.FocusStreamId = opentokService.focusStreamId;
+ locals.Layout = OpenTokUtils.convertToCamelCase(opentokService.layout.ToString());
+ return View["participant", locals];
+ });
+ Post("/start", _ =>
+ {
+ bool horizontal = Request.Form["layout"] == "horizontalPresentation";
+ var layoutType = new BroadcastLayout(horizontal
+ ? BroadcastLayout.LayoutType.HorizontalPresentation
+ : BroadcastLayout.LayoutType.VerticalPresentation);
+ var maxDuration = 7200;
+ if (Request.Form["maxDuration"] != null)
+ {
+ maxDuration = int.Parse(Request.Form["maxDuration"]);
+ }
- public class MainModule : NancyModule
- {
-
- public MainModule(OpenTokService opentokService)
- {
-
- Get["/"] = _ => View["index"];
-
- Get["/host"] = _ =>
- {
-
- dynamic locals = new ExpandoObject();
-
- locals.ApiKey = opentokService.OpenTok.ApiKey.ToString();
- locals.SessionId = opentokService.Session.Id;
- locals.Token = opentokService.Session.GenerateToken(Role.PUBLISHER, 0, null, new List (new string[] { "focus"}));
- locals.InitialBroadcastId = opentokService.broadcastId;
- locals.FocusStreamId = opentokService.focusStreamId;
- locals.InitialLayout = OpenTokUtils.convertToCamelCase(opentokService.layout.ToString());
-
- return View["host", locals];
- };
-
- Get["/participant"] = _ =>
- {
- dynamic locals = new ExpandoObject();
-
- locals.ApiKey = opentokService.OpenTok.ApiKey.ToString();
- locals.SessionId = opentokService.Session.Id;
- locals.Token = opentokService.Session.GenerateToken();
- locals.FocusStreamId = opentokService.focusStreamId;
- locals.Layout = OpenTokUtils.convertToCamelCase(opentokService.layout.ToString());
-
- return View["participant", locals];
- };
-
- Post["/start"] = _ =>
- {
- bool horizontal = Request.Form["layout"] == "horizontalPresentation";
- BroadcastLayout layoutType = new BroadcastLayout(horizontal ? BroadcastLayout.LayoutType.HorizontalPresentation : BroadcastLayout.LayoutType.VerticalPresentation);
- int maxDuration = 7200;
- if (Request.Form["maxDuration"] != null)
- {
- maxDuration = int.Parse(Request.Form["maxDuration"]);
- }
- Broadcast broadcast = opentokService.OpenTok.StartBroadcast(
- opentokService.Session.Id,
- hls: true,
- rtmpList: null,
- resolution: Request.Form["resolution"],
- maxDuration: maxDuration,
- layout: layoutType
- );
- opentokService.broadcastId = broadcast.Id.ToString();
- return broadcast;
- };
+ Broadcast broadcast = opentokService.OpenTok.StartBroadcast(
+ opentokService.Session.Id,
+ hls: true,
+ rtmpList: null,
+ resolution: Request.Form["resolution"],
+ maxDuration: maxDuration,
+ layout: layoutType
+ );
+ opentokService.broadcastId = broadcast.Id;
+ return broadcast;
+ });
+ Get("/stop/{id}", parameters =>
+ {
+ Broadcast broadcast = opentokService.OpenTok.StopBroadcast(parameters.id);
+ opentokService.broadcastId = "";
+ return broadcast;
+ });
+ Get("/broadcast", _ =>
+ {
+ if (!string.IsNullOrEmpty(opentokService.broadcastId))
+ {
+ try
+ {
+ var broadcast = opentokService.OpenTok.GetBroadcast(opentokService.broadcastId);
+ if (broadcast.Status == Broadcast.BroadcastStatus.STARTED)
+ {
+ return Response.AsRedirect(broadcast.Hls);
+ }
- Get["/stop/{id}"] = parameters =>
- {
- Broadcast broadcast = opentokService.OpenTok.StopBroadcast(parameters.id);
- opentokService.broadcastId = "";
- return broadcast;
- };
+ return this.Response.AsText("Broadcast not in progress.");
+ }
+ catch (Exception ex)
+ {
+ return Response.AsText("Could not get broadcast " + opentokService.broadcastId +
+ ". Exception Message: " + ex.Message);
+ }
+ }
- Get["/broadcast"] = _ =>
- {
- if (!String.IsNullOrEmpty(opentokService.broadcastId))
- {
- try
- {
- Broadcast broadcast = opentokService.OpenTok.GetBroadcast(opentokService.broadcastId);
- if(broadcast.Status == Broadcast.BroadcastStatus.STARTED)
- {
- return Response.AsRedirect(broadcast.Hls);
- }
- else
- {
- return Response.AsText("Broadcast not in progress.");
- }
- }
- catch (Exception ex)
- {
- return Response.AsText("Could not get broadcast " + opentokService.broadcastId + ". Exception Message: " + ex.Message);
- }
- } else {
- return Response.AsText("There's no broadcast running right now.");
- }
- };
+ return this.Response.AsText("There's no broadcast running right now.");
+ });
+ Get("/broadcast/{id}/layout/{layo,ut}", parameters =>
+ {
+ bool horizontal = parameters.layout == "horizontalPresentation";
+ var layout = new BroadcastLayout(horizontal
+ ? BroadcastLayout.LayoutType.HorizontalPresentation
+ : BroadcastLayout.LayoutType.VerticalPresentation);
+ opentokService.OpenTok.SetBroadcastLayout(parameters.id, layout);
+ return HttpStatusCode.OK;
+ });
+ Post("/focus", _ =>
+ {
+ string focusStreamId = Request.Form["focus"];
+ opentokService.focusStreamId = focusStreamId;
+ var streamList = opentokService.OpenTok.ListStreams(opentokService.Session.Id);
+ var streamPropertiesList = new List();
+ foreach (var stream in streamList)
+ {
+ var streamProperties = new StreamProperties(stream.Id);
+ if (focusStreamId.Equals(stream.Id))
+ {
+ streamProperties.addLayoutClass("focus");
+ }
- Get["/broadcast/{id}/layout/{layout}"] = parameters =>
- {
- bool horizontal = parameters.layout == "horizontalPresentation";
- BroadcastLayout layout = new BroadcastLayout(horizontal ? BroadcastLayout.LayoutType.HorizontalPresentation : BroadcastLayout.LayoutType.VerticalPresentation);
- opentokService.OpenTok.SetBroadcastLayout(parameters.id, layout);
- return HttpStatusCode.OK;
- };
+ streamPropertiesList.Add(streamProperties);
+ }
- Post["/focus"] = _ =>
- {
- string focusStreamId = Request.Form["focus"];
- opentokService.focusStreamId = focusStreamId;
- StreamList streamList = opentokService.OpenTok.ListStreams(opentokService.Session.Id);
- List streamPropertiesList = new List();
- foreach (Stream stream in streamList)
- {
- StreamProperties streamProperties = new StreamProperties(stream.Id, null);
- if (focusStreamId.Equals(stream.Id))
- {
- streamProperties.addLayoutClass("focus");
- }
- streamPropertiesList.Add(streamProperties);
- }
- opentokService.OpenTok.SetStreamClassLists(opentokService.Session.Id, streamPropertiesList);
- return HttpStatusCode.OK;
- };
- }
- }
-}
+ opentokService.OpenTok.SetStreamClassLists(opentokService.Session.Id, streamPropertiesList);
+ return HttpStatusCode.OK;
+ });
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/HelloWorld/HelloWorld.csproj b/Samples/HelloWorld/HelloWorld.csproj
index 4c911c46..48426406 100644
--- a/Samples/HelloWorld/HelloWorld.csproj
+++ b/Samples/HelloWorld/HelloWorld.csproj
@@ -3,18 +3,12 @@
HelloWorld
1.0.0
- net452
+ net481
Vonage
Vonage
Copyright © 2020
Exe
-
-
-
-
-
-
@@ -34,4 +28,9 @@
+
+
+
+
+
diff --git a/Samples/HelloWorld/MainModule.cs b/Samples/HelloWorld/MainModule.cs
index 470c9193..5903f57e 100644
--- a/Samples/HelloWorld/MainModule.cs
+++ b/Samples/HelloWorld/MainModule.cs
@@ -5,20 +5,18 @@ namespace HelloWorld
{
public class MainModule : NancyModule
{
-
public MainModule(OpenTokService opentokService)
{
+ Get("/", _ =>
+ {
+ dynamic locals = new ExpandoObject();
- Get["/"] = _ =>
- {
- dynamic locals = new ExpandoObject();
-
- locals.ApiKey = opentokService.OpenTok.ApiKey.ToString();
- locals.SessionId = opentokService.Session.Id;
- locals.Token = opentokService.Session.GenerateToken();
+ locals.ApiKey = opentokService.OpenTok.ApiKey.ToString();
+ locals.SessionId = opentokService.Session.Id;
+ locals.Token = opentokService.Session.GenerateToken();
- return View["index", locals];
- };
+ return View["index", locals];
+ });
}
}
}