Commit 9dc1753a authored by Ghislain MARY's avatar Ghislain MARY

Use listener to activate video showing or hiding (PauseStateChanged() method...

Use listener to activate video showing or hiding (PauseStateChanged() method called on StreamsRunning call state).
parent 77a47c44
using Linphone.Model;
using Linphone.Core;
using Linphone.Model;
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
......@@ -26,7 +27,7 @@ namespace Linphone
/// <summary>
/// Called when the call changes its state to paused or resumed.
/// </summary>
void PauseStateChanged(bool isMicMuted);
void PauseStateChanged(LinphoneCall call, bool isCallPaused);
}
/// <summary>
......@@ -76,7 +77,7 @@ namespace Linphone
/// Called when a call is finished.
/// Goes back to the last page if possible, else displays Dialer.xaml.
/// </summary>
public void CallEnded()
public void CallEnded(LinphoneCall call)
{
Logger.Msg("[CallListener] Call ended, can go back ? " + this.Page.NavigationService.CanGoBack);
......@@ -103,10 +104,10 @@ namespace Linphone
/// <summary>
/// Called when the call changes its state to paused or resumed.
/// </summary>
public void PauseStateChanged(bool isCallPaused)
public void PauseStateChanged(LinphoneCall call, bool isCallPaused)
{
if (this.PauseListener != null)
this.PauseListener.PauseStateChanged(isCallPaused);
this.PauseListener.PauseStateChanged(call, isCallPaused);
}
/// <summary>
......

using Linphone.Core;
namespace Linphone.Model
{
/// <summary>
......@@ -14,7 +16,7 @@ namespace Linphone.Model
/// <summary>
/// Called when a call is ended.
/// </summary>
void CallEnded();
void CallEnded(LinphoneCall call);
/// <summary>
/// Called when the mute status of the microphone changes.
......@@ -24,6 +26,6 @@ namespace Linphone.Model
/// <summary>
/// Called when the call changes its state to paused or resumed.
/// </summary>
void PauseStateChanged(bool isCallPaused);
void PauseStateChanged(LinphoneCall call, bool isCallPaused);
}
}
......@@ -656,7 +656,7 @@ namespace Linphone.Model
BaseModel.UIDispatcher.BeginInvoke(() =>
{
if (CallListener != null)
CallListener.CallEnded();
CallListener.CallEnded(call);
});
}
else if (state == LinphoneCallState.Paused || state == LinphoneCallState.PausedByRemote)
......@@ -665,7 +665,7 @@ namespace Linphone.Model
BaseModel.UIDispatcher.BeginInvoke(() =>
{
if (CallListener != null)
CallListener.PauseStateChanged(true);
CallListener.PauseStateChanged(call, true);
});
}
else if (state == LinphoneCallState.StreamsRunning)
......@@ -674,7 +674,7 @@ namespace Linphone.Model
BaseModel.UIDispatcher.BeginInvoke(() =>
{
if (CallListener != null)
CallListener.PauseStateChanged(false);
CallListener.PauseStateChanged(call, false);
});
}
else if (state == LinphoneCallState.Released)
......
......@@ -41,7 +41,7 @@ namespace Linphone.Views
var call = LinphoneManager.Instance.LinphoneCore.GetCurrentCall();
if (call != null && call.GetState() == Core.LinphoneCallState.StreamsRunning)
{
PauseStateChanged(false);
PauseStateChanged(call, false);
}
}
......@@ -183,7 +183,7 @@ namespace Linphone.Views
/// <summary>
/// Called when the call changes its state to paused or resumed.
/// </summary>
public void PauseStateChanged(bool isCallPaused)
public void PauseStateChanged(LinphoneCall call, bool isCallPaused)
{
pause.IsChecked = isCallPaused;
pauseImg.Source = new BitmapImage(new Uri(isCallPaused ? pauseOn : pauseOff, UriKind.RelativeOrAbsolute));
......@@ -191,6 +191,23 @@ namespace Linphone.Views
if (!isCallPaused)
{
oneSecondTimer = new Timer(new TimerCallback(timerTick), null, 0, 1000);
if (call.IsCameraEnabled() && !((InCallModel)ViewModel).IsVideoActive)
{
// Show video if it was not shown yet
((InCallModel)ViewModel).IsVideoActive = true;
video.IsChecked = true;
ButtonsFadeInVideoAnimation.Begin();
StartFadeTimer();
}
else if (!call.IsCameraEnabled() && ((InCallModel)ViewModel).IsVideoActive)
{
// Stop video if it is no longer active
((InCallModel)ViewModel).IsVideoActive = false;
video.IsChecked = false;
ButtonsFadeInAudioAnimation.Begin();
StopFadeTimer();
}
}
else if (oneSecondTimer != null)
{
......@@ -252,23 +269,6 @@ namespace Linphone.Views
{
VideoStats.Visibility = Visibility.Collapsed;
}
if (call.IsCameraEnabled() && !((InCallModel)ViewModel).IsVideoActive)
{
// Show video if it was not shown yet
((InCallModel)ViewModel).IsVideoActive = true;
video.IsChecked = true;
ButtonsFadeInVideoAnimation.Begin();
StartFadeTimer();
}
else if (!call.IsCameraEnabled() && ((InCallModel)ViewModel).IsVideoActive)
{
// Stop video if it is no longer active
((InCallModel)ViewModel).IsVideoActive = false;
video.IsChecked = false;
ButtonsFadeInAudioAnimation.Begin();
StopFadeTimer();
}
});
} catch {
oneSecondTimer.Dispose();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment