Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit d43ab02

Browse files
authored
Unity Error Events and Cleaning (#84)
* Added errors event, cleaning * Documentation for error events * Bumped version to 1.0.0 * Documentation fixes
1 parent fe8e3c8 commit d43ab02

File tree

10 files changed

+143
-31
lines changed

10 files changed

+143
-31
lines changed

cmake/version.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
set(CSSDK_MAJOR 1)
22
set(CSSDK_MINOR 0)
3-
set(CSSDK_PATH 0-beta.1)
3+
set(CSSDK_PATH 0)

docs/documentation/unity/visualscripting.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,22 @@ Emitted when the active audio device has [changed](xref:DolbyIO.Comms.Services.M
182182
<img style="padding:25px 0" src="~/images/nodes/event-audio-changed.png" width="250px">
183183
</div>
184184

185+
### On Signaling Channel Error Event
186+
187+
Emitted when an error occurs during a Session Initiation Protocol (SIP) negotiation of the local participant's peer connection.
188+
189+
<div style="text-align:center">
190+
<img style="padding:25px 0" src="~/images/nodes/event-signaling-error.png" width="250px">
191+
</div>
192+
193+
### On Invalid Token Error Event
194+
195+
Emitted when the access token is invalid or has expired.
196+
197+
<div style="text-align:center">
198+
<img style="padding:25px 0" src="~/images/nodes/event-token-error.png" width="250px">
199+
</div>
200+
185201
## Examples
186202
### Joining a Conference
187203

21.9 KB
Loading
19.6 KB
Loading

scripts/Units/DolbyIOUnit.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,22 @@ private IEnumerator InitAndOpen(Flow flow)
9494
}
9595
);
9696

97+
_sdk.InvalidTokenError = new InvalidTokenErrorEventHandler
98+
(
99+
(string reason, string description) =>
100+
{
101+
DolbyIOManager.QueueOnMainThread(() => EventBus.Trigger(EventNames.InvalidTokenErrorEvent, $"${reason}: ${description}"));
102+
}
103+
);
104+
105+
_sdk.SignalingChannelError = new SignalingChannelErrorEventHandler
106+
(
107+
(string message) =>
108+
{
109+
DolbyIOManager.QueueOnMainThread(() => EventBus.Trigger(EventNames.InvalidTokenErrorEvent, $"${message}"));
110+
}
111+
);
112+
97113
var userInfo = new UserInfo();
98114
userInfo.Name = flow.GetValue<string>(ParticipantName);
99115

scripts/Units/EventNames.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@ public static class EventNames
88
public static string ActiveSpeakerChangeEvent = "ActiveSpeakerChangeEvent";
99
public static string AudioDeviceChangedEvent = "AudioDeviceChangedEvent";
1010
public static string AudioDeviceAddedEvent = "AudioDeviceAddedEvent";
11+
public static string InvalidTokenErrorEvent = "InvalidTokenErrorEvent";
12+
public static string SignalingChannelErrorEvent = "SignalingChannelErrorEvent";
1113
}
1214
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using System.Threading.Tasks;
4+
using UnityEngine;
5+
using Unity.VisualScripting;
6+
using DolbyIO.Comms;
7+
8+
namespace DolbyIO.Comms.Unity
9+
{
10+
[UnitTitle("On Invalid Token Error Event")]
11+
[UnitCategory("Events\\DolbyIO")]
12+
public class InvalidTokenErrorEvent : EventUnit<string>
13+
{
14+
[DoNotSerialize]
15+
public ValueOutput Message { get; private set; }
16+
protected override bool register => true;
17+
18+
// Adding an EventHook with the name of the event to the list of visual scripting events.
19+
public override EventHook GetHook(GraphReference reference)
20+
{
21+
return new EventHook(EventNames.InvalidTokenErrorEvent);
22+
}
23+
24+
protected override void Definition()
25+
{
26+
base.Definition();
27+
// Setting the value on our port.
28+
Message = ValueOutput<string>(nameof(Message));
29+
}
30+
31+
// Setting the value on our port.
32+
protected override void AssignArguments(Flow flow, string data)
33+
{
34+
flow.SetValue(Message, data);
35+
}
36+
}
37+
}

scripts/Units/PlayerPositionUnit.cs

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,31 @@ private ControlOutput SetPosition(Flow flow)
2727
{
2828
var direction = flow.GetValue<Vector3>(Direction);
2929
var position = flow.GetValue<Vector3>(Postition);
30-
31-
_sdk.Conference.SetSpatialPositionAsync
32-
(
33-
_sdk.Session.User.Id,
34-
new System.Numerics.Vector3(position.x, position.y, position.z)
35-
)
36-
.ContinueWith(t =>
30+
31+
if (_sdk.IsInitialized && _sdk.Session.IsOpen && _sdk.Conference.IsInConference)
3732
{
38-
if (t.IsFaulted)
33+
_sdk.Conference.SetSpatialPositionAsync
34+
(
35+
_sdk.Session.User.Id,
36+
new System.Numerics.Vector3(position.x, position.y, position.z)
37+
)
38+
.ContinueWith(t =>
3939
{
40-
throw t.Exception;
41-
}
40+
if (t.IsFaulted)
41+
{
42+
throw t.Exception;
43+
}
4244

43-
return _sdk.Conference.SetSpatialDirectionAsync
44-
(
45-
new System.Numerics.Vector3(direction.x, direction.y, direction.z)
46-
);
47-
})
48-
.ContinueWith(t =>
49-
{
50-
Debug.Log(t.Exception);
51-
}, TaskContinuationOptions.OnlyOnFaulted);
45+
return _sdk.Conference.SetSpatialDirectionAsync
46+
(
47+
new System.Numerics.Vector3(direction.x, direction.y, direction.z)
48+
);
49+
})
50+
.ContinueWith(t =>
51+
{
52+
Debug.Log(t.Exception);
53+
}, TaskContinuationOptions.OnlyOnFaulted);
54+
}
5255

5356
return OutputTrigger;
5457
}

scripts/Units/RemotePlayerPositionUnit.cs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,20 @@ private ControlOutput SetPosition(Flow flow)
2929
var position = flow.GetValue<Vector3>(Postition);
3030
var p = flow.GetValue<Participant>(Participant);
3131

32-
Debug.Log(p.Id);
33-
34-
if (p.Id != _sdk.Session.User.Id)
32+
if (_sdk.IsInitialized && _sdk.Session.IsOpen && _sdk.Conference.IsInConference)
3533
{
36-
_sdk.Conference.SetSpatialPositionAsync
37-
(
38-
p.Id,
39-
new System.Numerics.Vector3(position.x, position.y, position.z)
40-
)
41-
.ContinueWith(t =>
34+
if (p.Id != _sdk.Session.User.Id)
4235
{
43-
Debug.Log(t.Exception);
44-
}, TaskContinuationOptions.OnlyOnFaulted);
36+
_sdk.Conference.SetSpatialPositionAsync
37+
(
38+
p.Id,
39+
new System.Numerics.Vector3(position.x, position.y, position.z)
40+
)
41+
.ContinueWith(t =>
42+
{
43+
Debug.Log(t.Exception);
44+
}, TaskContinuationOptions.OnlyOnFaulted);
45+
}
4546
}
4647

4748
return OutputTrigger;
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using System.Threading.Tasks;
4+
using UnityEngine;
5+
using Unity.VisualScripting;
6+
using DolbyIO.Comms;
7+
8+
namespace DolbyIO.Comms.Unity
9+
{
10+
[UnitTitle("On Signaling Channel Error Event")]
11+
[UnitCategory("Events\\DolbyIO")]
12+
public class SignalingChannelErrorEvent : EventUnit<string>
13+
{
14+
[DoNotSerialize]
15+
public ValueOutput Message { get; private set; }
16+
protected override bool register => true;
17+
18+
// Adding an EventHook with the name of the event to the list of visual scripting events.
19+
public override EventHook GetHook(GraphReference reference)
20+
{
21+
return new EventHook(EventNames.SignalingChannelErrorEvent);
22+
}
23+
24+
protected override void Definition()
25+
{
26+
base.Definition();
27+
// Setting the value on our port.
28+
Message = ValueOutput<string>(nameof(Message));
29+
}
30+
31+
// Setting the value on our port.
32+
protected override void AssignArguments(Flow flow, string data)
33+
{
34+
flow.SetValue(Message, data);
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)