diff --git a/Samples/V1.0Samples/LocalMediaSamples/AudioVideoPlaybackBot/FrontEnd/Bot/BotMediaStream.cs b/Samples/V1.0Samples/LocalMediaSamples/AudioVideoPlaybackBot/FrontEnd/Bot/BotMediaStream.cs
index 47f8ca8d..8302fd14 100644
--- a/Samples/V1.0Samples/LocalMediaSamples/AudioVideoPlaybackBot/FrontEnd/Bot/BotMediaStream.cs
+++ b/Samples/V1.0Samples/LocalMediaSamples/AudioVideoPlaybackBot/FrontEnd/Bot/BotMediaStream.cs
@@ -72,12 +72,14 @@ public BotMediaStream(ILocalMediaSession mediaSession, IGraphLogger logger)
}
this.audioSocket.AudioSendStatusChanged += this.OnAudioSendStatusChanged;
+ this.audioSocket.AudioMediaReceived += this.OnAudioMediaReceived;
this.mainVideoSocket = this.mediaSession.VideoSockets?.FirstOrDefault();
if (this.mainVideoSocket != null)
{
this.mainVideoSocket.VideoSendStatusChanged += this.OnVideoSendStatusChanged;
this.mainVideoSocket.VideoKeyFrameNeeded += this.OnVideoKeyFrameNeeded;
+ this.mainVideoSocket.VideoMediaReceived += this.OnVideoMediaReceived;
}
this.videoSockets = this.mediaSession.VideoSockets?.ToList();
@@ -185,12 +187,14 @@ public async Task ShutdownAsync()
if (this.audioSocket != null)
{
this.audioSocket.AudioSendStatusChanged -= this.OnAudioSendStatusChanged;
+ this.audioSocket.AudioMediaReceived -= this.OnAudioMediaReceived;
}
if (this.mainVideoSocket != null)
{
this.mainVideoSocket.VideoKeyFrameNeeded -= this.OnVideoKeyFrameNeeded;
this.mainVideoSocket.VideoSendStatusChanged -= this.OnVideoSendStatusChanged;
+ this.mainVideoSocket.VideoMediaReceived -= this.OnVideoMediaReceived;
}
if (this.vbssSocket != null)
@@ -325,6 +329,25 @@ private void OnAudioSendStatusChanged(object sender, AudioSendStatusChangedEvent
}
}
+ ///
+ /// Save screenshots when we receive audio from the subscribed participant.
+ ///
+ ///
+ /// The sender.
+ ///
+ ///
+ /// The audio media received arguments.
+ ///
+ private void OnAudioMediaReceived(object sender, AudioMediaReceivedEventArgs e)
+ {
+ // leave only logging in here
+ this.logger.Info($"[AudioMediaReceivedEventArgs(Data=<{e.Buffer.Data.ToString()}>, Length={e.Buffer.Length}, Timestamp={e.Buffer.Timestamp}, AudioFormat={e.Buffer.AudioFormat}, IsSilence={e.Buffer.IsSilence}, ActiveSpeakers=[{string.Join(", ", e.Buffer.ActiveSpeakers)}])]");
+
+ /* TODO: Do something with audio here */
+
+ e.Buffer.Dispose();
+ }
+
///
/// Callback for informational updates from the media plaform about video status changes.
/// Once the Status becomes active, then video can be sent.
@@ -348,9 +371,9 @@ private void OnVideoSendStatusChanged(object sender, VideoSendStatusChangedEvent
// starting from beginning
if (!this.videoSendStatusActive.TrySetResult(true))
{
- if (this.videoKnownSupportedFormats != null && this.videoKnownSupportedFormats.Any() &&
-
- // here it means we got a new video fromat so we need to restart the player
+ if (this.videoKnownSupportedFormats != null && this.videoKnownSupportedFormats.Any() &&
+
+ // here it means we got a new video fromat so we need to restart the player
this.videoKnownSupportedFormats.Select(x => x.GetId()).Except(previousSupportedFormats.Select(y => y.GetId())).Any())
{
// we restart the player
@@ -375,6 +398,25 @@ private void OnVideoSendStatusChanged(object sender, VideoSendStatusChangedEvent
}
}
+ ///
+ /// Save screenshots when we receive video from the subscribed participant.
+ ///
+ ///
+ /// The sender.
+ ///
+ ///
+ /// The video media received arguments.
+ ///
+ private void OnVideoMediaReceived(object sender, VideoMediaReceivedEventArgs e)
+ {
+ // leave only logging in here
+ this.logger.Info($"[VideoMediaReceivedEventArgs(Data=<{e.Buffer.Data.ToString()}>, Length={e.Buffer.Length}, Timestamp={e.Buffer.Timestamp}, Width={e.Buffer.VideoFormat.Width}, Height={e.Buffer.VideoFormat.Height}, ColorFormat={e.Buffer.VideoFormat.VideoColorFormat}, FrameRate={e.Buffer.VideoFormat.FrameRate})]");
+
+ /* TODO: Do something with video here */
+
+ e.Buffer.Dispose();
+ }
+
///
/// If the application has configured the VideoSocket to receive encoded media, this
/// event is raised each time a key frame is needed. Events are serialized, so only
diff --git a/Samples/V1.0Samples/LocalMediaSamples/AudioVideoPlaybackBot/FrontEnd/Bot/CallHandler.cs b/Samples/V1.0Samples/LocalMediaSamples/AudioVideoPlaybackBot/FrontEnd/Bot/CallHandler.cs
index 0ffbc56f..12ca765c 100644
--- a/Samples/V1.0Samples/LocalMediaSamples/AudioVideoPlaybackBot/FrontEnd/Bot/CallHandler.cs
+++ b/Samples/V1.0Samples/LocalMediaSamples/AudioVideoPlaybackBot/FrontEnd/Bot/CallHandler.cs
@@ -54,9 +54,6 @@ public CallHandler(ICall statefulCall)
// subscribe to dominant speaker event on the audioSocket
this.Call.GetLocalMediaSession().AudioSocket.DominantSpeakerChanged += this.OnDominantSpeakerChanged;
- // subscribe to the VideoMediaReceived event on the main video socket
- this.Call.GetLocalMediaSession().VideoSockets.FirstOrDefault().VideoMediaReceived += this.OnVideoMediaReceived;
-
// susbscribe to the participants updates, this will inform the bot if a particpant left/joined the conference
this.Call.Participants.OnUpdated += this.ParticipantsOnUpdated;
@@ -91,7 +88,6 @@ protected override void Dispose(bool disposing)
base.Dispose(disposing);
this.Call.GetLocalMediaSession().AudioSocket.DominantSpeakerChanged -= this.OnDominantSpeakerChanged;
- this.Call.GetLocalMediaSession().VideoSockets.FirstOrDefault().VideoMediaReceived -= this.OnVideoMediaReceived;
this.Call.OnUpdated -= this.CallOnUpdated;
this.Call.Participants.OnUpdated -= this.ParticipantsOnUpdated;
@@ -289,23 +285,6 @@ private void OnDominantSpeakerChanged(object sender, DominantSpeakerChangedEvent
}
}
- ///
- /// Save screenshots when we receive video from subscribed participant.
- ///
- ///
- /// The sender.
- ///
- ///
- /// The video media received arguments.
- ///
- private void OnVideoMediaReceived(object sender, VideoMediaReceivedEventArgs e)
- {
- // leave only logging in here
- this.GraphLogger.Info($"[{this.Call.Id}]: Capturing image: [VideoMediaReceivedEventArgs(Data=<{e.Buffer.Data.ToString()}>, Length={e.Buffer.Length}, Timestamp={e.Buffer.Timestamp}, Width={e.Buffer.VideoFormat.Width}, Height={e.Buffer.VideoFormat.Height}, ColorFormat={e.Buffer.VideoFormat.VideoColorFormat}, FrameRate={e.Buffer.VideoFormat.FrameRate})]");
-
- e.Buffer.Dispose();
- }
-
///
/// Gets the participant with the corresponding MSI.
///