Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-client-uwp
Commits
61e6f0ee
Commit
61e6f0ee
authored
Nov 04, 2016
by
Nicolas Jager
Browse files
video : add mute button and logic
Change-Id: Ibb60353cabc33cf0e92a662272d9f96ef33e27b8
parent
4569bf50
Changes
10
Hide whitespace changes
Inline
Side-by-side
MessageTextPage.xaml
View file @
61e6f0ee
...
...
@@ -128,28 +128,44 @@
Padding="10,10">
<Image Source="ms-appx:///contact-avatar-test.png" />
<StackPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<TextBlock x:Name="_title_"
Grid.Column="0"
Text="[TEXT MISSING]"
TextWrapping="NoWrap"
VerticalAlignment="Center"
FontSize="20"
Margin="20,0" />
<Button x:Name="_audioCall_"
Grid.Column="1"
Click="_audioCall__Click"
Content="audio call"/>
<Button x:Name="_videoCall_"
Click="_videoCall__Click"
Grid.Column="2"
Content="video call"/>
</Grid>
<StackPanel Orientation="Horizontal">
<ComboBox x:Name="_associableAccountsList_">
<ComboBox.ItemTemplate>
<DataTemplate x:DataType="local:Account">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{x:Bind name_, Mode=OneWay}" />
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Button x:Name="_deleteContact_"
Content="delete"
Click="_deleteContact__Click"/>
<ComboBox x:Name="_associableAccountsList_">
<ComboBox.ItemTemplate>
<DataTemplate x:DataType="local:Account">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{x:Bind name_, Mode=OneWay}" />
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Button x:Name="_deleteContact_"
Content="delete"
Click="_deleteContact__Click"/>
<Button x:Name="_clearConversation_"
Content="clear conversation"
Click="_clearConversation__Click"/>
Content="clear conversation"
Click="_clearConversation__Click"/>
</StackPanel>
</StackPanel>
...
...
MessageTextPage.xaml.cpp
View file @
61e6f0ee
...
...
@@ -199,3 +199,31 @@ void RingClientUWP::Views::MessageTextPage::_clearConversation__Click(Platform::
contact
->
_conversation
->
_messages
->
Clear
();
contact
->
saveConversationToFile
();
}
void
RingClientUWP
::
Views
::
MessageTextPage
::
_audioCall__Click
(
Platform
::
Object
^
sender
,
Windows
::
UI
::
Xaml
::
RoutedEventArgs
^
e
)
{
auto
button
=
dynamic_cast
<
Button
^>
(
e
->
OriginalSource
);
if
(
button
)
{
auto
item
=
SmartPanelItemsViewModel
::
instance
->
_selectedItem
;
if
(
item
)
{
auto
contact
=
item
->
_contact
;
if
(
contact
)
RingD
::
instance
->
placeCall
(
contact
);
}
}
}
void
RingClientUWP
::
Views
::
MessageTextPage
::
_videoCall__Click
(
Platform
::
Object
^
sender
,
Windows
::
UI
::
Xaml
::
RoutedEventArgs
^
e
)
{
auto
button
=
dynamic_cast
<
Button
^>
(
e
->
OriginalSource
);
if
(
button
)
{
auto
item
=
SmartPanelItemsViewModel
::
instance
->
_selectedItem
;
if
(
item
)
{
auto
contact
=
item
->
_contact
;
if
(
contact
)
RingD
::
instance
->
placeCall
(
contact
);
}
}
}
MessageTextPage.xaml.h
View file @
61e6f0ee
...
...
@@ -59,6 +59,8 @@ private:
void
_deleteContact__Click
(
Platform
::
Object
^
sender
,
Windows
::
UI
::
Xaml
::
RoutedEventArgs
^
e
);
void
_clearConversation__Click
(
Platform
::
Object
^
sender
,
Windows
::
UI
::
Xaml
::
RoutedEventArgs
^
e
);
void
_audioCall__Click
(
Platform
::
Object
^
sender
,
Windows
::
UI
::
Xaml
::
RoutedEventArgs
^
e
);
void
_videoCall__Click
(
Platform
::
Object
^
sender
,
Windows
::
UI
::
Xaml
::
RoutedEventArgs
^
e
);
};
}
}
RingD.cpp
View file @
61e6f0ee
...
...
@@ -29,6 +29,7 @@
#include
"account_const.h"
#include
"string_utils.h"
// used to get some const expr like TRUE_STR
#include
"gnutls\gnutls.h"
#include
"media_const.h"
// used to get some const expr like MEDIA_TYPE_VIDEO
#include
"SmartPanel.xaml.h"
...
...
@@ -582,6 +583,8 @@ RingClientUWP::RingD::startDaemon()
Utils
::
toPlatformString
(
id
),
width
,
height
);
auto
callId2
=
Utils
::
toPlatformString
(
id
);
incomingVideoMuted
(
callId2
,
false
);
}));
}),
DRing
::
exportable_callback
<
DRing
::
VideoSignal
::
DecodingStopped
>
...
...
@@ -589,6 +592,8 @@ RingClientUWP::RingD::startDaemon()
dispatcher
->
RunAsync
(
CoreDispatcherPriority
::
High
,
ref
new
DispatchedHandler
([
=
]()
{
Video
::
VideoManager
::
instance
->
rendererManager
()
->
removeRenderer
(
Utils
::
toPlatformString
(
id
));
auto
callId2
=
Utils
::
toPlatformString
(
id
);
incomingVideoMuted
(
callId2
,
true
);
}));
})
};
...
...
@@ -879,6 +884,12 @@ RingD::dequeueTasks()
debugModeOn_
=
!
debugModeOn_
;
break
;
}
case
Request
::
MuteVideo
:
{
auto
callId
=
Utils
::
toString
(
task
->
_callId
);
bool
muted
=
task
->
_muted
;
DRing
::
muteLocalMedia
(
callId
,
DRing
::
Media
::
Details
::
MEDIA_TYPE_VIDEO
,
muted
);
}
default:
break
;
}
...
...
@@ -922,6 +933,16 @@ void RingClientUWP::RingD::switchDebug()
tasksList_
.
push
(
task
);
}
void
RingClientUWP
::
RingD
::
muteVideo
(
String
^
callId
,
bool
muted
)
{
auto
task
=
ref
new
RingD
::
Task
(
Request
::
MuteVideo
);
task
->
_callId
=
callId
;
task
->
_muted
=
muted
;
tasksList_
.
push
(
task
);
}
RingClientUWP
::
CallStatus
RingClientUWP
::
RingD
::
translateCallStatus
(
String
^
state
)
{
if
(
state
==
"INCOMING"
)
...
...
RingD.h
View file @
61e6f0ee
...
...
@@ -36,6 +36,7 @@ delegate void DevicesListRefreshed(Vector<String^>^ devicesList);
delegate
void
ExportOnRingEnded
(
String
^
accountId
,
String
^
pin
);
delegate
void
SummonWizard
();
delegate
void
AccountUpdated
(
Account
^
account
);
delegate
void
IncomingVideoMuted
(
String
^
callId
,
bool
state
);
public
ref
class
RingD
sealed
...
...
@@ -102,6 +103,7 @@ internal:
void
getCallsList
();
void
killCall
(
String
^
callId
);
void
switchDebug
();
void
muteVideo
(
String
^
callId
,
bool
muted
);
/* TODO : move members */
String
^
currentCallId
;
// to save ongoing call id during visibility change
...
...
@@ -116,6 +118,7 @@ internal:
event
ExportOnRingEnded
^
exportOnRingEnded
;
event
SummonWizard
^
summonWizard
;
event
AccountUpdated
^
accountUpdated
;
event
IncomingVideoMuted
^
incomingVideoMuted
;
private:
/* sub classes */
...
...
@@ -137,6 +140,7 @@ private:
GetCallsList
,
KillCall
,
switchDebug
,
MuteVideo
};
...
...
@@ -168,6 +172,7 @@ private:
property
String
^
_sipPassword
;
property
String
^
_sipHostname
;
property
String
^
_sipUsername
;
property
bool
_muted
;
};
/* functions */
...
...
SmartPanelItem.cpp
View file @
61e6f0ee
...
...
@@ -32,10 +32,17 @@ using namespace ViewModel;
SmartPanelItem
::
SmartPanelItem
()
{
_callId
=
""
;
videoMuted_
=
false
;
RingD
::
instance
->
callPlaced
+=
ref
new
RingClientUWP
::
CallPlaced
(
this
,
&
RingClientUWP
::
Controls
::
SmartPanelItem
::
OncallPlaced
);
}
void
RingClientUWP
::
Controls
::
SmartPanelItem
::
muteVideo
(
bool
state
)
{
videoMuted_
=
state
;
RingD
::
instance
->
muteVideo
(
_callId
,
state
);
}
void
SmartPanelItem
::
NotifyPropertyChanged
(
String
^
propertyName
)
{
...
...
SmartPanelItem.h
View file @
61e6f0ee
...
...
@@ -29,6 +29,7 @@ public ref class SmartPanelItem sealed : public INotifyPropertyChanged
{
public:
SmartPanelItem
();
void
muteVideo
(
bool
state
);
virtual
event
PropertyChangedEventHandler
^
PropertyChanged
;
property
Contact
^
_contact
;
...
...
@@ -74,6 +75,13 @@ public:
NotifyPropertyChanged
(
"_callStatus"
);
}
}
property
bool
_videoMuted
{
bool
get
()
{
return
videoMuted_
;
}
}
protected:
void
NotifyPropertyChanged
(
String
^
propertyName
);
...
...
@@ -82,6 +90,7 @@ private:
Visibility
hovered_
=
Visibility
::
Collapsed
;
CallStatus
callStatus_
;
String
^
callId_
;
bool
videoMuted_
;
void
OncallPlaced
(
Platform
::
String
^
callId
);
};
...
...
VideoPage.xaml
View file @
61e6f0ee
...
...
@@ -155,6 +155,16 @@
<Image Name="IncomingVideoImage"
Grid.Column="0"
Canvas.ZIndex="-1"/>
<TextBlock Name="_MutedVideoIcon_"
Grid.Column="0"
Text=""
Foreground="White"
FontSize="200"
VerticalAlignment="Center"
HorizontalAlignment="Center"
FontFamily="Segoe MDL2 Assets"
Visibility="Collapsed"
Canvas.ZIndex="-1"/>
<!--camera preview-->
<CaptureElement Name="PreviewImage"
...
...
@@ -300,7 +310,8 @@
<Button x:Name="_btnVideo_"
PointerEntered="btnAny_entered"
PointerExited="btnAny_exited"
Tapped="_btnVideo__Tapped" Visibility="Collapsed">
Click="_btnVideo__Click"
Tapped="_btnVideo__Tapped">
<SymbolIcon Symbol="Video"/>
</Button>
<Button x:Name="_btnMemo_"
...
...
VideoPage.xaml.cpp
View file @
61e6f0ee
...
...
@@ -41,6 +41,7 @@ using namespace Windows::UI::Xaml::Navigation;
using
namespace
Windows
::
Media
::
Capture
;
using
namespace
Windows
::
ApplicationModel
::
Core
;
using
namespace
Windows
::
UI
::
Core
;
using
namespace
Windows
::
UI
;
using
namespace
Windows
::
Graphics
::
Display
;
using
namespace
Windows
::
Graphics
::
Imaging
;
...
...
@@ -130,6 +131,7 @@ VideoPage::VideoPage()
});
RingD
::
instance
->
incomingMessage
+=
ref
new
RingClientUWP
::
IncomingMessage
(
this
,
&
RingClientUWP
::
Views
::
VideoPage
::
OnincomingMessage
);
RingD
::
instance
->
incomingVideoMuted
+=
ref
new
RingClientUWP
::
IncomingVideoMuted
(
this
,
&
RingClientUWP
::
Views
::
VideoPage
::
OnincomingVideoMuted
);
}
void
...
...
@@ -346,3 +348,23 @@ void RingClientUWP::Views::VideoPage::OnincomingMessage(Platform::String ^callId
{
scrollDown
();
}
void
RingClientUWP
::
Views
::
VideoPage
::
_btnVideo__Click
(
Platform
::
Object
^
sender
,
Windows
::
UI
::
Xaml
::
RoutedEventArgs
^
e
)
{
auto
item
=
SmartPanelItemsViewModel
::
instance
->
_selectedItem
;
item
->
muteVideo
(
!
item
->
_videoMuted
);
}
void
RingClientUWP
::
Views
::
VideoPage
::
OnincomingVideoMuted
(
Platform
::
String
^
callId
,
bool
state
)
{
/*_MutedVideoIcon_->Visibility = (state)
? Windows::UI::Xaml::Visibility::Visible
: Windows::UI::Xaml::Visibility::Collapsed;*/
IncomingVideoImage
->
Visibility
=
(
state
)
?
Windows
::
UI
::
Xaml
::
Visibility
::
Collapsed
:
Windows
::
UI
::
Xaml
::
Visibility
::
Visible
;
}
VideoPage.xaml.h
View file @
61e6f0ee
...
...
@@ -116,6 +116,8 @@ private:
void
btnAny_entered
(
Platform
::
Object
^
sender
,
Windows
::
UI
::
Xaml
::
Input
::
PointerRoutedEventArgs
^
e
);
void
btnAny_exited
(
Platform
::
Object
^
sender
,
Windows
::
UI
::
Xaml
::
Input
::
PointerRoutedEventArgs
^
e
);
void
OnincomingMessage
(
Platform
::
String
^
callId
,
Platform
::
String
^
payload
);
void
_btnVideo__Click
(
Platform
::
Object
^
sender
,
Windows
::
UI
::
Xaml
::
RoutedEventArgs
^
e
);
void
OnincomingVideoMuted
(
Platform
::
String
^
callId
,
bool
state
);
};
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment