Skip to content

Commit

Permalink
Merging Dev into Main for Release (#189)
Browse files Browse the repository at this point in the history
* Correction to docs for automatic archiving

* Fixes NullReferenceException in CreateSession (#114)

* Better handle WebExceptions that don't have a Response and send a customized exception on WebExceptionStatus.SendFailure errors (usually from TLS errors).
Fixes #108.

* Adding extra instructions regarding TLS to readme, adding new exception handling if TLS is incorrect

* removing erroneously added whitespace

* list archive by session id, better exception handling for validateSessionid

* removing extra whitespace from tests

* cleaning up other whitespace issues

* passing inner exception to OpenTokException

* Fixing comments, removing redundant fields

* adding custom layout for archiving

* fixing spacing issue, adding javadocs to StartArchive for layout

* revving to 3.4

* adding extra Archive Test

* Adding non-custom with stylesheet case

* adding contract annotations to ArchiveLayout to prevent invalid serialization of the stylesheet for non-custom layouts

* bringing balance to the force

* Dropping core 3.0 tests

* moving back to newer container

* removing .net core 2.x runs

* Silenced warnings in the test project.

* empty Statement Redundancy Fix

* Spell Fix

* Spell Fix

* Spell Fix | GetPartnerIdFromSessionId

Spell Fix | GetPartnerIdFromSessionId method's Property

* moving dotnet version

* specifying test framework

* Changed Javadoc comments to XML comments.

* Replace <see href with <a href.

* Added additional comments.

* Revving to 3.5.0

* automatic release on new GitHub release

* adding OUTPUT_PATH

* fixing Windows CI issue

* updating nexmo/github-actions branch to main

* screenshare layout

* more tests

* Adding SetArchiveLayout, updating unit tests

* moving null ignore to data structure

* fixing error message

* fixing screenshareType

* revving to 3.6.0

* Removing travis config

* Removing travis, fixing GitHub Actions definitions and adding package settings in project file (#164)

* Docs corrections (#161)

Co-authored-by: Stephen Lorello <42971704+slorello89@users.noreply.github.com>
Co-authored-by: slorello89 <slorello89@gmail.com>
Co-authored-by: Dirk Lemstra <dirk@lemstra.org>
Co-authored-by: onpoc <gupta.pradeep506@gmail.com>
Co-authored-by: Matt Hunt <mattlethargic@gmail.com>
Co-authored-by: Jeff Swartz <jeff.swartz@vonage.com>

* Implementing Dial method for initiating a SIP call (#166)

* Adding Dial method, test fails

* Adding dial async and tests

* Adding session validation

* Removing key from appsettings

* Adding valid session id to tests

* Docs edits for Dial API

... and other minor docs corrections

Co-authored-by: Jeff Swartz <jeff.swartz@vonage.com>

* Rev the version to 3.7.0

* Adding Force and Disable Mute (#167)

* Adding Force and Disable Mute

* Docs edits for the Force Mute API enhancements

* Fixing PlayDTMF methods that had wrong URL

Co-authored-by: Jeff Swartz <jeff.swartz@vonage.com>
Co-authored-by: matt-lethargic <matt-lethargic@gmail.com>

* Docs edits for v3.7.0 (#169)

* Changing version number (#170)

* Docs corrections

* Selective adding of streams for archive and broadcast (#174)

* Selective adding of streams for archive and broadcast

* Minor docs edits for StreamMode additions

* bumping version to 3.8.0

* Another version bump

Co-authored-by: Jeff Swartz <jeff.swartz@vonage.com>

* Devx 5778 (#179)

* Moving tests

* refactoring test base

* CreateSession async

* Start Archive Async

* Fixing dial issue

* Removing duplicate version tags in proj file and updating README with Async methods

Co-authored-by: matt-lethargic <matt-lethargic@gmail.com>

* Minor docs typo correction (#181)

* Adding GetArchive and DeleteArchive async methods (#182)

* Adding GetArchive and DeleteArchive async methods

* Adding readme info and adding methods to Archieve object

* DVR and LowLatency changes added (#183)

* DVR and LowLatency changes added

* Update OpenTok/OpenTok.cs

Co-authored-by: Jeff Swartz <jeff.swartz@vonage.com>

* Fixing comments for PR

* Adding Broadcast settings summary

* Docs edits

 for BroadcastHlsSettings and related content.

Co-authored-by: Jeff Swartz <jeff.swartz@vonage.com>

Co-authored-by: Jeff Swartz <jeff.swartz@vonage.com>
Co-authored-by: Paul Ardeleanu <paul.ardeleanu@vonage.com>
Co-authored-by: Patrick Childers <patrick@aliihealthcare.com>
Co-authored-by: Stephen Lorello <42971704+slorello89@users.noreply.github.com>
Co-authored-by: slorello89 <slorello89@gmail.com>
Co-authored-by: Dirk Lemstra <dirk@lemstra.org>
Co-authored-by: onpoc <gupta.pradeep506@gmail.com>
Co-authored-by: matt-lethargic <matt-lethargic@gmail.com>
  • Loading branch information
9 people authored May 16, 2022
1 parent 471d03c commit 7acd44d
Show file tree
Hide file tree
Showing 51 changed files with 3,618 additions and 1,090 deletions.
61 changes: 39 additions & 22 deletions OpenTok/Archive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OpenTokSDK
{
Expand Down Expand Up @@ -77,7 +78,7 @@ public enum OutputMode
public class Archive
{

private OpenTok opentok;
private readonly OpenTok _opentok;

/// <summary>
/// Initializes a new instance of the <see cref="Archive"/> class.
Expand All @@ -88,25 +89,26 @@ protected Archive()

internal Archive(OpenTok opentok)
{
this.opentok = opentok;
_opentok = opentok;
}

internal void CopyArchive(Archive archive)
{
this.CreatedAt = archive.CreatedAt;
this.Duration = archive.Duration;
this.Id = archive.Id;
this.Name = archive.Name;
this.PartnerId = archive.PartnerId;
this.SessionId = archive.SessionId;
this.Size = archive.Size;
this.Status = archive.Status;
this.Url = archive.Url;
this.Password = archive.Password;
this.HasVideo = archive.HasVideo;
this.HasAudio = archive.HasAudio;
this.OutputMode = archive.OutputMode;
this.Resolution = archive.Resolution;
CreatedAt = archive.CreatedAt;
Duration = archive.Duration;
Id = archive.Id;
Name = archive.Name;
PartnerId = archive.PartnerId;
SessionId = archive.SessionId;
Size = archive.Size;
Status = archive.Status;
Url = archive.Url;
Password = archive.Password;
HasVideo = archive.HasVideo;
HasAudio = archive.HasAudio;
OutputMode = archive.OutputMode;
Resolution = archive.Resolution;
StreamMode = archive.StreamMode;
}

/// <summary>
Expand Down Expand Up @@ -194,6 +196,11 @@ internal void CopyArchive(Archive archive)
/// </summary>
public String Password { get; set; }

/// <summary>
/// Whether streams included in the archive are selected automatically ("auto", the default) or manually.
/// </summary>
public StreamMode StreamMode { get; set; }

/// <summary>
/// Stops the OpenTok archive if it is being recorded.
/// <para>
Expand All @@ -203,9 +210,9 @@ internal void CopyArchive(Archive archive)
/// </summary>
public void Stop()
{
if (opentok != null)
if (_opentok != null)
{
Archive archive = opentok.StopArchive(Id.ToString());
Archive archive = _opentok.StopArchive(Id.ToString());
Status = archive.Status;
}
}
Expand All @@ -220,10 +227,20 @@ public void Stop()
/// </summary>
public void Delete()
{
if (opentok != null)
{
opentok.DeleteArchive(Id.ToString());
}
_opentok?.DeleteArchive(Id.ToString());
}

/// <summary>
/// Deletes the OpenTok archive.
/// <para>
/// You can only delete an archive which has a status of "available" or "uploaded". Deleting
/// an archive removes its record from the list of archives. For an "available" archive, it
/// also removes the archive file, making it unavailable for download.
/// </para>
/// </summary>
public Task DeleteAsync()
{
return _opentok?.DeleteArchiveAsync(Id.ToString());
}
}
}
96 changes: 76 additions & 20 deletions OpenTok/Broadcast.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,45 @@ public enum BroadcastStatus
STARTED
}

private OpenTok opentok;
/// <summary>
/// Provides details on an HLS broadcast stream. This object includes an <c>hls</c> property
/// that specifies whether
/// <a href="https://tokbox.com/developer/guides/broadcast/live-streaming/#dvr">DVR functionality</a>
/// and <a href="https://tokbox.com/developer/guides/broadcast/live-streaming/#low-latency">low-latency mode</a>
/// are enabled for the HLS stream.
/// </summary>
public class BroadcastSettings
{
/// <summary>
/// Provides details on the HLS stream.
/// </summary>
[JsonProperty("hls")]
public BroadcastHlsSettings Hls { get; private set; }
}

/// <summary>
/// Provides details on an HLS stream.
/// </summary>
public class BroadcastHlsSettings
{
/// <summary>
/// Whether
/// <a href="https://tokbox.com/developer/guides/broadcast/live-streaming/#low-latency">low-latency mode</a>
/// is enabled for the HLS stream.
/// </summary>
[JsonProperty("lowLatency")]
public bool LowLatency { get; private set; }

/// <summary>
/// Whether
/// <a href="https://tokbox.com/developer/guides/broadcast/live-streaming/#dvr">DVR functionality</a>
/// is enabled for the HLS stream.
/// </summary>
[JsonProperty("dvr")]
public bool DVR { get; private set; }
}

private readonly OpenTok _opentok;

/// <summary>
/// Initializes a new instance of the <see cref="Broadcast"/> class.
Expand All @@ -37,7 +75,7 @@ protected Broadcast()

internal Broadcast(OpenTok opentok)
{
this.opentok = opentok;
_opentok = opentok;
}

internal void CopyBroadcast(Broadcast broadcast)
Expand All @@ -51,25 +89,30 @@ internal void CopyBroadcast(Broadcast broadcast)
MaxDuration = broadcast.MaxDuration;
Status = broadcast.Status;
BroadcastUrls = broadcast.BroadcastUrls;
StreamMode = broadcast.StreamMode;
Settings = broadcast.Settings;

if (BroadcastUrls == null)
return;

if (BroadcastUrls != null)
if (BroadcastUrls.ContainsKey("hls"))
{
if (BroadcastUrls.ContainsKey("hls"))
{
Hls = BroadcastUrls["hls"].ToString();
}
Hls = BroadcastUrls["hls"].ToString();
}

if (BroadcastUrls.ContainsKey("rtmp"))
if (BroadcastUrls.ContainsKey("rtmp"))
{
RtmpList = new List<Rtmp>();
foreach (var jsonToken in (JArray)BroadcastUrls["rtmp"])
{
RtmpList = new List<Rtmp>();
foreach (JObject item in (JArray)BroadcastUrls["rtmp"])
var item = (JObject) jsonToken;
Rtmp rtmp = new Rtmp
{
Rtmp rtmp = new Rtmp();
rtmp.Id = item.GetValue("id").ToString();
rtmp.ServerUrl = item.GetValue("serverUrl").ToString();
rtmp.StreamName = item.GetValue("streamName").ToString();
RtmpList.Add(rtmp);
}
Id = item.GetValue("id")?.ToString(),
ServerUrl = item.GetValue("serverUrl")?.ToString(),
StreamName = item.GetValue("streamName")?.ToString()
};
RtmpList.Add(rtmp);
}
}
}
Expand All @@ -84,7 +127,7 @@ internal void CopyBroadcast(Broadcast broadcast)
/// The session ID of the OpenTok session associated with this broadcast.
/// </summary>
[JsonProperty("sessionId")]
public String SessionId { get; set; }
public string SessionId { get; set; }

/// <summary>
/// The OpenTok API key associated with the broadcast.
Expand Down Expand Up @@ -130,22 +173,35 @@ internal void CopyBroadcast(Broadcast broadcast)
/// <summary>
/// HLS Url.
/// </summary>
public String Hls { get; set; }
public string Hls { get; set; }

/// <summary>
/// The broadcast HLS and RTMP URLs.
/// </summary>
[JsonProperty("broadcastUrls")]
private Dictionary<string, object> BroadcastUrls { get; set; }

/// <summary>
/// Whether streams included in the broadcast are selected automatically ("auto", the default) or manually
/// </summary>
[JsonProperty("streamMode")]
public StreamMode StreamMode { get; set; }

/// <summary>
/// Provides details on an HLS broadcast stream. This includes information on
/// whether the stream supports DVR functionality and low-latency mode.
/// </summary>
[JsonProperty("settings")]
public BroadcastSettings Settings { get; set; }

/// <summary>
/// Stops the live broadcasting if it is started.
/// </summary>
public void Stop()
{
if (opentok != null)
if (_opentok != null)
{
Broadcast broadcast = opentok.StopBroadcast(Id);
Broadcast broadcast = _opentok.StopBroadcast(Id);
Status = broadcast.Status;
}
}
Expand Down
2 changes: 1 addition & 1 deletion OpenTok/DialAuth.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Runtime.Serialization;
using System.Runtime.Serialization;
using Newtonsoft.Json;

namespace OpenTokSDK
Expand Down
Loading

0 comments on commit 7acd44d

Please sign in to comment.