Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Commit

Permalink
Add On Local Participant Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Audykowicz committed Aug 9, 2023
1 parent b1bc7e7 commit 1d3afa6
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 4 deletions.
16 changes: 16 additions & 0 deletions DolbyIO/Source/Private/Subsystem/DolbyIOConference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ void UDolbyIOSubsystem::Handle(const remote_participant_added& Event)
{
return;
}

const FDolbyIOParticipantInfo Info = ToFDolbyIOParticipantInfo(Event.participant);
DLB_UE_LOG("Participant status added: UserID=%s Name=%s ExternalID=%s Status=%s", *Info.UserID, *Info.Name,
*Info.ExternalID, *ToString(*Event.participant.status));
Expand All @@ -253,6 +254,7 @@ void UDolbyIOSubsystem::Handle(const remote_participant_updated& Event)
{
return;
}

const FDolbyIOParticipantInfo Info = ToFDolbyIOParticipantInfo(Event.participant);
DLB_UE_LOG("Participant status updated: UserID=%s Name=%s ExternalID=%s Status=%s", *Info.UserID, *Info.Name,
*Info.ExternalID, *ToString(*Event.participant.status));
Expand All @@ -264,6 +266,20 @@ void UDolbyIOSubsystem::Handle(const remote_participant_updated& Event)
BroadcastEvent(OnParticipantUpdated, Info.Status, Info);
}

void UDolbyIOSubsystem::Handle(const local_participant_updated& Event)
{
if (!Event.participant.status)
{
return;
}

const FDolbyIOParticipantInfo Info = ToFDolbyIOParticipantInfo(Event.participant);
DLB_UE_LOG("Local participant status updated: UserID=%s Name=%s ExternalID=%s Status=%s", *Info.UserID, *Info.Name,
*Info.ExternalID, *ToString(*Event.participant.status));

BroadcastEvent(OnLocalParticipantUpdated, Info.Status, Info);
}

void UDolbyIOSubsystem::Handle(const conference_message_received& Event)
{
const FString Message = ToFString(Event.message);
Expand Down
11 changes: 7 additions & 4 deletions DolbyIO/Source/Private/Subsystem/DolbyIOInitialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ void UDolbyIOSubsystem::Initialize(const FString& Token)
.then(DLB_REGISTER_HANDLER(device_management, audio_device_changed))
.then(DLB_REGISTER_HANDLER(conference, audio_levels))
.then(DLB_REGISTER_HANDLER(conference, conference_message_received))
.then(DLB_REGISTER_HANDLER(conference, local_participant_updated))
.then(DLB_REGISTER_HANDLER(conference, remote_participant_added))
.then(DLB_REGISTER_HANDLER(conference, remote_participant_updated))
.then(DLB_REGISTER_HANDLER(conference, remote_video_track_added))
Expand Down Expand Up @@ -176,10 +177,10 @@ void UDolbyIOObserver::InitializeComponent()
DLB_BIND(OnConnectError);
DLB_BIND(OnDemoConferenceError);

DLB_BIND(OnDisconnected)
DLB_BIND(OnDisconnected);
DLB_BIND(OnDisconnectError);

DLB_BIND(OnSetSpatialEnvironmentScaleError)
DLB_BIND(OnSetSpatialEnvironmentScaleError);

DLB_BIND(OnMuteInputError);

Expand All @@ -197,6 +198,8 @@ void UDolbyIOObserver::InitializeComponent()

DLB_BIND(OnParticipantUpdated);

DLB_BIND(OnLocalParticipantUpdated);

DLB_BIND(OnVideoTrackAdded);

DLB_BIND(OnVideoTrackRemoved);
Expand All @@ -205,7 +208,7 @@ void UDolbyIOObserver::InitializeComponent()

DLB_BIND(OnVideoTrackDisabled);

DLB_BIND(OnVideoEnabled)
DLB_BIND(OnVideoEnabled);
DLB_BIND(OnEnableVideoError);

DLB_BIND(OnVideoDisabled);
Expand All @@ -218,7 +221,7 @@ void UDolbyIOObserver::InitializeComponent()
DLB_BIND(OnStartScreenshareError);

DLB_BIND(OnScreenshareStopped);
DLB_BIND(OnStopScreenshareError)
DLB_BIND(OnStopScreenshareError);

DLB_BIND(OnChangeScreenshareParametersError);

Expand Down
14 changes: 14 additions & 0 deletions DolbyIO/Source/Public/DolbyIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FDolbyIOOnParticipantAddedDelegate,
Status, const FDolbyIOParticipantInfo&, ParticipantInfo);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FDolbyIOOnParticipantUpdatedDelegate, const EDolbyIOParticipantStatus,
Status, const FDolbyIOParticipantInfo&, ParticipantInfo);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FDolbyIOOnLocalParticipantUpdatedDelegate, const EDolbyIOParticipantStatus,
Status, const FDolbyIOParticipantInfo&, ParticipantInfo);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDolbyIOOnVideoTrackAddedDelegate, const FDolbyIOVideoTrack&, VideoTrack);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDolbyIOOnVideoTrackRemovedDelegate, const FDolbyIOVideoTrack&, VideoTrack);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDolbyIOOnVideoTrackEnabledDelegate, const FDolbyIOVideoTrack&, VideoTrack);
Expand Down Expand Up @@ -306,6 +308,8 @@ class DOLBYIO_API UDolbyIOSubsystem : public UGameInstanceSubsystem
UPROPERTY(BlueprintAssignable, Category = "Dolby.io Comms")
FDolbyIOOnParticipantUpdatedDelegate OnParticipantUpdated;
UPROPERTY(BlueprintAssignable, Category = "Dolby.io Comms")
FDolbyIOOnLocalParticipantUpdatedDelegate OnLocalParticipantUpdated;
UPROPERTY(BlueprintAssignable, Category = "Dolby.io Comms")
FDolbyIOOnVideoTrackAddedDelegate OnVideoTrackAdded;
UPROPERTY(BlueprintAssignable, Category = "Dolby.io Comms")
FDolbyIOOnVideoTrackRemovedDelegate OnVideoTrackRemoved;
Expand Down Expand Up @@ -349,6 +353,7 @@ class DOLBYIO_API UDolbyIOSubsystem : public UGameInstanceSubsystem
void Handle(const dolbyio::comms::audio_device_changed&);
void Handle(const dolbyio::comms::audio_levels&);
void Handle(const dolbyio::comms::conference_message_received&);
void Handle(const dolbyio::comms::local_participant_updated&);
void Handle(const dolbyio::comms::remote_participant_added&);
void Handle(const dolbyio::comms::remote_participant_updated&);
void Handle(const dolbyio::comms::remote_video_track_added&);
Expand Down Expand Up @@ -477,6 +482,10 @@ class DOLBYIO_API UDolbyIOObserver : public UActorComponent
UPROPERTY(BlueprintAssignable, Category = "Dolby.io Comms")
FDolbyIOOnParticipantUpdatedDelegate OnParticipantUpdated;

/** Triggered when the local participant's status is updated. */
UPROPERTY(BlueprintAssignable, Category = "Dolby.io Comms")
FDolbyIOOnLocalParticipantUpdatedDelegate OnLocalParticipantUpdated;

/** Triggered when a video track is added. */
UPROPERTY(BlueprintAssignable, Category = "Dolby.io Comms")
FDolbyIOOnVideoTrackAddedDelegate OnVideoTrackAdded;
Expand Down Expand Up @@ -701,6 +710,11 @@ class DOLBYIO_API UDolbyIOObserver : public UActorComponent
void FwdOnParticipantUpdated(const EDolbyIOParticipantStatus Status, const FDolbyIOParticipantInfo& ParticipantInfo)
DLB_DEFINE_FORWARDER(OnParticipantUpdated, Status, ParticipantInfo);

UFUNCTION()
void FwdOnLocalParticipantUpdated(const EDolbyIOParticipantStatus Status,
const FDolbyIOParticipantInfo& ParticipantInfo)
DLB_DEFINE_FORWARDER(OnLocalParticipantUpdated, Status, ParticipantInfo);

UFUNCTION()
void FwdOnVideoTrackAdded(const FDolbyIOVideoTrack& VideoTrack) DLB_DEFINE_FORWARDER(OnVideoTrackAdded, VideoTrack);

Expand Down
1 change: 1 addition & 0 deletions DolbyIO/Source/Public/DolbyIOCppSdkFwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace dolbyio::comms
struct audio_device_changed;
struct audio_levels;
struct conference_message_received;
struct local_participant_updated;
struct remote_participant_added;
struct remote_participant_updated;
struct remote_video_track_added;
Expand Down
12 changes: 12 additions & 0 deletions docs/docs/blueprints/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,18 @@ Triggered by [**Dolby.io Set Token**](functions.md#dolbyio-set-token) when the p

---

## On Local Participant Updated

Triggered when the local participant's status is updated as a result of calling [Connect](functions.md#dolbyio-connect), [Demo Conference](functions.md#dolbyio-demo-conference) or [Update User Metadata](functions.md#dolbyio-update-user-metadata).

#### Data provided
| Provides | Type | Description |
|---|:---|:---|
| **Status** | [Dolby.io Participant Status](types.mdx#dolbyio-participant-status) | The status of the participant. |
| **Participant Info** | [Dolby.io Participant Info](types.mdx#dolbyio-participant-info) | Information about the participant. |

---

## On Message Received

Triggered automatically when a message is received.
Expand Down

0 comments on commit 1d3afa6

Please sign in to comment.