-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update gitignore to ignore Jetbrains Rider files * Update projects versions; unsupported framework versions have been removed * Update packages in Test project * Update dependencies in HelloWorld sample * Update packages in Archiving sample app * Update packages in Broadcasting sample app * Update packages in OpenTok project * Remove unnecessary target-specific shenanigans * Fix issue in Test csproj * Update build pipeline
- Loading branch information
Showing
10 changed files
with
219 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"); | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.