Skip to content
Snippets Groups Projects
Commit 60022a5d authored by Nicolas Jager's avatar Nicolas Jager
Browse files

Audio : implementation of (un)muting actions.

Change-Id: I034fe535593ddf41e825c97ba707164c9e256268
Tuleap: #790
parent 890921f2
Branches
Tags
No related merge requests found
...@@ -419,6 +419,21 @@ RingD::registerCallbacks() ...@@ -419,6 +419,21 @@ RingD::registerCallbacks()
stateChange(Utils::toPlatformString(callId), CallStatus::IN_PROGRESS, 0); stateChange(Utils::toPlatformString(callId), CallStatus::IN_PROGRESS, 0);
})); }));
}), }),
DRing::exportable_callback<DRing::CallSignal::AudioMuted>([this](
const std::string& callId,
bool state)
{
// why this cllaback exist ? why are we not using stateChange ?
MSG_("<AudioMuted>");
MSG_("callId = " + callId);
MSG_("state = " + Utils::toString(state.ToString()));
CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(
CoreDispatcherPriority::High, ref new DispatchedHandler([=]()
{
audioMuted(callId, state);
}));
}),
DRing::exportable_callback<DRing::CallSignal::StateChange>([this]( DRing::exportable_callback<DRing::CallSignal::StateChange>([this](
const std::string& callId, const std::string& callId,
const std::string& state, const std::string& state,
...@@ -1045,6 +1060,12 @@ RingD::dequeueTasks() ...@@ -1045,6 +1060,12 @@ RingD::dequeueTasks()
bool muted = task->_muted; bool muted = task->_muted;
DRing::muteLocalMedia(callId, DRing::Media::Details::MEDIA_TYPE_VIDEO, muted); DRing::muteLocalMedia(callId, DRing::Media::Details::MEDIA_TYPE_VIDEO, muted);
} }
case Request::MuteAudio:
{
DRing::muteLocalMedia(task->_callid_new
, DRing::Media::Details::MEDIA_TYPE_AUDIO
, task->_audioMuted_new);
}
case Request::LookUpName: case Request::LookUpName:
{ {
auto alias = task->_alias; auto alias = task->_alias;
...@@ -1129,6 +1150,16 @@ void RingClientUWP::RingD::muteVideo(String ^ callId, bool muted) ...@@ -1129,6 +1150,16 @@ void RingClientUWP::RingD::muteVideo(String ^ callId, bool muted)
tasksList_.push(task); tasksList_.push(task);
} }
void RingClientUWP::RingD::muteAudio(const std::string& callId, bool muted)
{
auto task = ref new RingD::Task(Request::MuteAudio);
task->_callid_new = callId;
task->_audioMuted_new = muted;
tasksList_.push(task);
}
void RingClientUWP::RingD::lookUpName(String ^ name) void RingClientUWP::RingD::lookUpName(String ^ name)
{ {
auto task = ref new RingD::Task(Request::LookUpName); auto task = ref new RingD::Task(Request::LookUpName);
......
...@@ -43,6 +43,7 @@ delegate void FinishCaptureDeviceEnumeration(); ...@@ -43,6 +43,7 @@ delegate void FinishCaptureDeviceEnumeration();
delegate void RegistrationStateErrorGeneric(const std::string& accountId); delegate void RegistrationStateErrorGeneric(const std::string& accountId);
delegate void RegistrationStateRegistered(); delegate void RegistrationStateRegistered();
delegate void CallsListRecieved(const std::vector<std::string>& callsList); delegate void CallsListRecieved(const std::vector<std::string>& callsList);
delegate void AudioMuted(const std::string& callId, bool state);
using SharedCallback = std::shared_ptr<DRing::CallbackWrapperBase>; using SharedCallback = std::shared_ptr<DRing::CallbackWrapperBase>;
using namespace std::placeholders; using namespace std::placeholders;
...@@ -129,6 +130,7 @@ internal: ...@@ -129,6 +130,7 @@ internal:
void killCall(String^ callId); void killCall(String^ callId);
void switchDebug(); void switchDebug();
void muteVideo(String^ callId, bool muted); void muteVideo(String^ callId, bool muted);
void muteAudio(const std::string& callId, bool muted);
void lookUpName(String^ name); void lookUpName(String^ name);
void registerName(String^ accountId, String^ password, String^ username); void registerName(String^ accountId, String^ password, String^ username);
void registerName_new(const std::string& accountId, const std::string& password, const std::string& username); void registerName_new(const std::string& accountId, const std::string& password, const std::string& username);
...@@ -155,6 +157,7 @@ internal: ...@@ -155,6 +157,7 @@ internal:
event RegistrationStateErrorGeneric^ registrationStateErrorGeneric; event RegistrationStateErrorGeneric^ registrationStateErrorGeneric;
event RegistrationStateRegistered^ registrationStateRegistered; event RegistrationStateRegistered^ registrationStateRegistered;
event CallsListRecieved^ callsListRecieved; // est implemente a la base pour regler le probleme du boutton d'appel qui est present lorsqu'un appel est en cours, mais il n'est pas utilise. Voir si ca peut servir a autre chose event CallsListRecieved^ callsListRecieved; // est implemente a la base pour regler le probleme du boutton d'appel qui est present lorsqu'un appel est en cours, mais il n'est pas utilise. Voir si ca peut servir a autre chose
event AudioMuted^ audioMuted;
private: private:
/* sub classes */ /* sub classes */
...@@ -178,6 +181,7 @@ private: ...@@ -178,6 +181,7 @@ private:
KillCall, KillCall,
switchDebug, switchDebug,
MuteVideo, MuteVideo,
MuteAudio,
LookUpName, LookUpName,
LookUpAddress, LookUpAddress,
RegisterName RegisterName
...@@ -222,6 +226,7 @@ private: ...@@ -222,6 +226,7 @@ private:
std::string _publicUsername_new; std::string _publicUsername_new;
std::string _callid_new; std::string _callid_new;
std::string _ringId_new; std::string _ringId_new;
bool _audioMuted_new;
}; };
/* functions */ /* functions */
......
...@@ -75,7 +75,7 @@ public: ...@@ -75,7 +75,7 @@ public:
NotifyPropertyChanged("_callStatus"); NotifyPropertyChanged("_callStatus");
} }
} }
property bool _videoMuted property bool _videoMuted // refacto : add set and remove void muteVideo(bool state);
{ {
bool get() bool get()
{ {
...@@ -83,6 +83,8 @@ public: ...@@ -83,6 +83,8 @@ public:
} }
} }
property bool _audioMuted;
property Visibility _showMe property Visibility _showMe
{ {
Visibility get() Visibility get()
......
...@@ -320,11 +320,26 @@ ...@@ -320,11 +320,26 @@
Tapped="_btnSwitch__Tapped" Visibility="Collapsed"> Tapped="_btnSwitch__Tapped" Visibility="Collapsed">
<SymbolIcon Symbol="Switch"/> <SymbolIcon Symbol="Switch"/>
</Button> </Button>
<!--Tapped="_btnMicrophone__Tapped"-->
<Button x:Name="_btnMicrophone_" <Button x:Name="_btnMicrophone_"
PointerEntered="btnAny_entered" PointerEntered="btnAny_entered"
PointerExited="btnAny_exited" PointerExited="btnAny_exited"
Tapped="_btnMicrophone__Tapped" Visibility="Collapsed"> Click="_btnMicrophone__Click">
<Grid>
<SymbolIcon Symbol="Microphone"/> <SymbolIcon Symbol="Microphone"/>
<TextBlock x:Name="_txbkMicrophoneMuted_"
Text="&#xE25B;"
FontSize="16"
IsHitTestVisible="True"
Visibility="Collapsed"
Foreground="Red"
FontWeight="Bold"
FontFamily="Segoe MDL2 Assets">
<TextBlock.RenderTransform>
<TranslateTransform X="1" Y="2"/>
</TextBlock.RenderTransform>
</TextBlock>
</Grid>
</Button> </Button>
<Button x:Name="_btnVideo_" <Button x:Name="_btnVideo_"
PointerEntered="btnAny_entered" PointerEntered="btnAny_entered"
......
...@@ -150,6 +150,7 @@ VideoPage::VideoPage() ...@@ -150,6 +150,7 @@ VideoPage::VideoPage()
RingD::instance->incomingVideoMuted += ref new RingClientUWP::IncomingVideoMuted(this, &RingClientUWP::Views::VideoPage::OnincomingVideoMuted); RingD::instance->incomingVideoMuted += ref new RingClientUWP::IncomingVideoMuted(this, &RingClientUWP::Views::VideoPage::OnincomingVideoMuted);
VideoManager::instance->captureManager()->startPreviewing += ref new RingClientUWP::StartPreviewing(this, &RingClientUWP::Views::VideoPage::OnstartPreviewing); VideoManager::instance->captureManager()->startPreviewing += ref new RingClientUWP::StartPreviewing(this, &RingClientUWP::Views::VideoPage::OnstartPreviewing);
VideoManager::instance->captureManager()->stopPreviewing += ref new RingClientUWP::StopPreviewing(this, &RingClientUWP::Views::VideoPage::OnstopPreviewing); VideoManager::instance->captureManager()->stopPreviewing += ref new RingClientUWP::StopPreviewing(this, &RingClientUWP::Views::VideoPage::OnstopPreviewing);
RingD::instance->audioMuted += ref new RingClientUWP::AudioMuted(this, &RingClientUWP::Views::VideoPage::OnaudioMuted);
} }
void void
...@@ -288,6 +289,13 @@ void RingClientUWP::Views::VideoPage::_btnSwitch__Tapped(Platform::Object^ sende ...@@ -288,6 +289,13 @@ void RingClientUWP::Views::VideoPage::_btnSwitch__Tapped(Platform::Object^ sende
void RingClientUWP::Views::VideoPage::_btnMicrophone__Tapped(Platform::Object^ sender, Windows::UI::Xaml::Input::TappedRoutedEventArgs^ e) void RingClientUWP::Views::VideoPage::_btnMicrophone__Tapped(Platform::Object^ sender, Windows::UI::Xaml::Input::TappedRoutedEventArgs^ e)
{ {
switchMicrophoneStateCall(); switchMicrophoneStateCall();
auto item = SmartPanelItemsViewModel::instance->_selectedItem;
auto state = !item->_audioMuted;
item->_audioMuted = state;
// refacto : compare how video and audios are muted, then decide which solution is best.
RingD::instance->muteAudio(Utils::toString(item->_callId), state); // nb : muteAudio == setMuteAudio
} }
...@@ -430,3 +438,23 @@ void RingClientUWP::Views::VideoPage::OnstopPreviewing() ...@@ -430,3 +438,23 @@ void RingClientUWP::Views::VideoPage::OnstopPreviewing()
{ {
PreviewImage->Visibility = Windows::UI::Xaml::Visibility::Collapsed; PreviewImage->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
} }
void RingClientUWP::Views::VideoPage::_btnMicrophone__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
switchMicrophoneStateCall();
auto item = SmartPanelItemsViewModel::instance->_selectedItem;
auto state = !item->_audioMuted;
item->_audioMuted = state;
// refacto : compare how video and audios are muted, then decide which solution is best.
RingD::instance->muteAudio(Utils::toString(item->_callId), state); // nb : muteAudio == setMuteAudio
}
void RingClientUWP::Views::VideoPage::OnaudioMuted(const std::string &callId, bool state)
{
_txbkMicrophoneMuted_->Visibility = (state) ? Windows::UI::Xaml::Visibility::Visible
: Windows::UI::Xaml::Visibility::Collapsed;
}
...@@ -122,6 +122,8 @@ private: ...@@ -122,6 +122,8 @@ private:
void OnincomingVideoMuted(Platform::String ^callId, bool state); void OnincomingVideoMuted(Platform::String ^callId, bool state);
void OnstartPreviewing(); void OnstartPreviewing();
void OnstopPreviewing(); void OnstopPreviewing();
void _btnMicrophone__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void OnaudioMuted(const std::string &callId, bool state);
}; };
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment