Commit 43ade797 authored by Margaux Clerc's avatar Margaux Clerc

Add video support

parent d2a8588f
......@@ -5,6 +5,8 @@ VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Linphone", "Linphone\Linphone.csproj", "{6122CCBD-FB37-48CE-9C50-0C8A35003AE6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSWinRTVideo", "submodules\mswinrtvid\MSWinRTVideo.vcxproj", "{2D0E44C4-E51D-4911-B876-345D1E5E5209}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -37,6 +39,20 @@ Global
{6122CCBD-FB37-48CE-9C50-0C8A35003AE6}.Release|x86.ActiveCfg = Release|x86
{6122CCBD-FB37-48CE-9C50-0C8A35003AE6}.Release|x86.Build.0 = Release|x86
{6122CCBD-FB37-48CE-9C50-0C8A35003AE6}.Release|x86.Deploy.0 = Release|x86
{2D0E44C4-E51D-4911-B876-345D1E5E5209}.Debug|Any CPU.ActiveCfg = Debug|Win32
{2D0E44C4-E51D-4911-B876-345D1E5E5209}.Debug|ARM.ActiveCfg = Debug|ARM
{2D0E44C4-E51D-4911-B876-345D1E5E5209}.Debug|ARM.Build.0 = Debug|ARM
{2D0E44C4-E51D-4911-B876-345D1E5E5209}.Debug|x64.ActiveCfg = Debug|x64
{2D0E44C4-E51D-4911-B876-345D1E5E5209}.Debug|x64.Build.0 = Debug|x64
{2D0E44C4-E51D-4911-B876-345D1E5E5209}.Debug|x86.ActiveCfg = Debug|Win32
{2D0E44C4-E51D-4911-B876-345D1E5E5209}.Debug|x86.Build.0 = Debug|Win32
{2D0E44C4-E51D-4911-B876-345D1E5E5209}.Release|Any CPU.ActiveCfg = Release|Win32
{2D0E44C4-E51D-4911-B876-345D1E5E5209}.Release|ARM.ActiveCfg = Release|ARM
{2D0E44C4-E51D-4911-B876-345D1E5E5209}.Release|ARM.Build.0 = Release|ARM
{2D0E44C4-E51D-4911-B876-345D1E5E5209}.Release|x64.ActiveCfg = Release|x64
{2D0E44C4-E51D-4911-B876-345D1E5E5209}.Release|x64.Build.0 = Release|x64
{2D0E44C4-E51D-4911-B876-345D1E5E5209}.Release|x86.ActiveCfg = Release|Win32
{2D0E44C4-E51D-4911-B876-345D1E5E5209}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
Linphone/Assets/Incall_Icons/camera.png

787 Bytes | W: | H:

Linphone/Assets/Incall_Icons/camera.png

1.19 KB | W: | H:

Linphone/Assets/Incall_Icons/camera.png
Linphone/Assets/Incall_Icons/camera.png
Linphone/Assets/Incall_Icons/camera.png
Linphone/Assets/Incall_Icons/camera.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -6,15 +6,8 @@ guess_hostname=1
inc_timeout=45
use_ipv6=0
register_only_when_network_is_up=1
auto_net_state_mon=0
keepalive_period=30000
ping_with_options=0
store_ha1_passwd=0
sip_port=-1
sip_tcp_port=-1
sip_tls_port=-1
inactive_video_on_pause=1
defer_update_default=1
[rtp]
audio_jitt_comp=60
......@@ -24,9 +17,6 @@ nortp_timeout=30
[sound]
dtmf_player_amp=0.1
[video]
displaytype=MSWP8Dis
[misc]
history_max_size=30
max_calls=1
......
......@@ -15,10 +15,6 @@
</Style>
</UserControl.Resources>
<UserControl.DataContext>
<Model:LinphoneManager/>
</UserControl.DataContext>
<StackPanel x:Name="LayoutRoot" Background="Transparent" Orientation="Horizontal" Padding="5,5,5,5" VerticalAlignment="Center">
<Image x:Name="StatusLed" Height="15" Width="15" Stretch="Uniform" Margin="10,0,5,0" VerticalAlignment="Center" ></Image>
<TextBlock x:Name="StatusText" Style="{StaticResource TextStyle}" VerticalAlignment="Center"></TextBlock>
......
......@@ -94,8 +94,9 @@
<ItemGroup>
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
<None Include="Assets\linphonerc" />
<None Include="Assets\linphonerc-factory" />
<Content Include="Assets\linphonerc-factory" />
<Content Include="Assets\avatar.png" />
<Content Include="Assets\avatar2.png" />
<Content Include="Assets\rootca.pem" />
<None Include="project.json" />
</ItemGroup>
......@@ -106,9 +107,6 @@
<Compile Include="Controls\AddressBox.xaml.cs">
<DependentUpon>AddressBox.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\CallControlsL.xaml.cs">
<DependentUpon>CallControlsL.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\CallControlsP.xaml.cs">
<DependentUpon>CallControlsP.xaml</DependentUpon>
</Compile>
......@@ -140,6 +138,7 @@
<Compile Include="Model\BugCollector.cs" />
<Compile Include="Model\CallControllerListener.cs" />
<Compile Include="Model\CallLogModel.cs" />
<Compile Include="Model\CodecModel.cs" />
<Compile Include="Model\ContactPictureConverter.cs" />
<Compile Include="Model\ContactsManager.cs" />
<Compile Include="Model\Conversation.cs" />
......@@ -246,10 +245,6 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Controls\CallControlsL.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Controls\CallControlsP.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
......@@ -367,7 +362,17 @@
<ItemGroup>
<PRIResource Include="String\en-US\Resources.resw" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<ProjectReference Include="..\submodules\mswinrtvid\MSWinRTVideo.vcxproj">
<Project>{2d0e44c4-e51d-4911-b876-345d1e5e5209}</Project>
<Name>MSWinRTVideo</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<SDKReference Include="WindowsMobile, Version=10.0.10586.0">
<Name>Windows Mobile Extensions for the UWP</Name>
</SDKReference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
......
......@@ -26,6 +26,7 @@ using System.Diagnostics;
using Linphone.Views;
using System.IO;
using Windows.Storage;
using Windows.Phone.Media.Devices;
namespace Linphone.Model
{
......@@ -46,7 +47,7 @@ namespace Linphone.Model
private Core _core;
private string _callStateText = "No call";
public bool isLinphoneRunning = false;
private string _linphoneFactoryPath;
public class CallEventArgs : EventArgs
{
......@@ -92,7 +93,7 @@ namespace Linphone.Model
{
if (_core == null)
{
LpConfig config = new LpConfig(GetConfigPath(), GetFactoryConfigPath());
LpConfig config = new LpConfig(GetConfigPath(),GetFactoryConfigPath());
_core = new Core(this, config);
}
return _core;
......@@ -149,52 +150,37 @@ namespace Linphone.Model
return Path.Combine(Windows.ApplicationModel.Package.Current.InstalledLocation.Path, "Assets", "linphonerc");
}
/// <summary>
/// Get the path of the config file stored in the Isolated Storage
/// </summary>
/// <returns>The path of the config file</returns>
public static String GetConfigPath()
{
return Path.Combine(ApplicationData.Current.LocalFolder.Path, "linphonerc");
}
/// <summary>
/// Get the path of the factory config file stored in the package
/// </summary>
/// <returns>The path of the factory config file</returns>
public static String GetFactoryConfigPath()
public String GetFactoryConfigPath()
{
return "Assets/linphonerc-factory";
return Path.Combine(Windows.ApplicationModel.Package.Current.InstalledLocation.Path, "Assets", "linphonerc-factory");
}
/// <summary>
/// Creates a new LinphoneCore (if not created yet) using a LinphoneCoreFactory.
/// </summary>
public async void InitLinphoneCore()
public String GetRootCaPath()
{
return Path.Combine(Windows.ApplicationModel.Package.Current.InstalledLocation.Path, "Assets", "rootca.pem");
}
public void InitLinphoneCore()
{
Core.LogLevel = OutputTraceLevel.Debug;
LinphoneManager.Instance.Core.ChatDatabasePath = GetChatDatabasePath();
var localFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
var originalDbFileUri = new Uri("ms-appx:///Assets/rootca.pem");
var assetFolder = await localFolder.GetFolderAsync(@"Assets");
var originalDbFile = await StorageFile.GetFileFromApplicationUriAsync(originalDbFileUri);
if (null != originalDbFile)
{
LinphoneManager.Instance.Core.RootCa = originalDbFile.Path;
}
LinphoneManager.Instance.Core.RootCa = GetRootCaPath();
//AudioRoutingManager.GetDefault().AudioEndpointChanged += AudioEndpointChanged;
AudioRoutingManager.GetDefault().AudioEndpointChanged += AudioEndpointChanged;
//CallController.MuteRequested += MuteRequested;
//CallController.UnmuteRequested += UnmuteRequested;
if (LinphoneManager.Instance.Core.IsVideoSupported)
{
// DetectCameras();
DetectCameras();
}
//LinphoneManager.Instance.Core..SetUserAgent(Customs.UserAgent, Linphone.Version.Number);
......@@ -205,6 +191,8 @@ namespace Linphone.Model
// ConfigureTunnel();
isLinphoneRunning = true;
Debug.WriteLine(LinphoneManager.Instance.Core.MaxCalls);
LinphoneManager.Instance.Core.IsIterateEnabled = true;
}
......@@ -223,14 +211,14 @@ namespace Linphone.Model
if (from.Length == 0)
{
Address fromAddress = log.FromAddress;
from = String.Format("{0}@{1}", fromAddress.UserName, fromAddress.Domain);
from = fromAddress.AsStringUriOnly();
}
string to = log.ToAddress.DisplayName;
if (to.Length == 0)
{
Address toAddress = log.ToAddress;
to = String.Format("{0}@{1}", toAddress.UserName, toAddress.Domain);
to = toAddress.AsStringUriOnly();
}
bool isMissed = log.Status == CallStatus.Missed;
......@@ -329,6 +317,10 @@ namespace Linphone.Model
}
}
private void AudioEndpointChanged(AudioRoutingManager sender, object args)
{
Debug.WriteLine("[LinphoneManager] AudioEndpointChanged:" + sender.GetAudioEndpoint().ToString() + "\r\n");
}
/// <summary>
/// Property that handles the audio routing between the speaker and the earpiece.
......@@ -338,15 +330,17 @@ namespace Linphone.Model
get
{
//AudioRoutingManager
//return AudioRoutingManager.GetDefault().GetAudioEndpoint() == AudioRoutingEndpoint.Speakerphone;
return false;
//
return AudioRoutingManager.GetDefault().GetAudioEndpoint() == AudioRoutingEndpoint.Speakerphone;
}
set
{
//if (value)
//AudioRoutingManager.GetDefault().SetAudioEndpoint(AudioRoutingEndpoint.Speakerphone);
//else
//AudioRoutingManager.GetDefault().SetAudioEndpoint(AudioRoutingEndpoint.Earpiece);
var toto = AudioRoutingManager.GetDefault().AvailableAudioEndpoints;
var titi = AudioRoutingManager.GetDefault().GetAudioEndpoint();
if (value)
AudioRoutingManager.GetDefault().SetAudioEndpoint(AudioRoutingEndpoint.Speakerphone);
else
AudioRoutingManager.GetDefault().SetAudioEndpoint(AudioRoutingEndpoint.Earpiece);
}
}
......@@ -399,6 +393,39 @@ namespace Linphone.Model
return null;
}
private void DetectCameras()
{
int nbCameras = 0;
foreach (String device in LinphoneManager.Instance.Core.VideoDevices)
{
if (device.Contains("Front"))
{
frontCamera = device;
nbCameras++;
}
else if (device.Contains("Back"))
{
backCamera = device;
nbCameras++;
}
}
String currentDevice = LinphoneManager.Instance.Core.VideoDevice;
if ((currentDevice != frontCamera) && (currentDevice != backCamera))
{
if (frontCamera != null)
{
Core.VideoDevice = frontCamera;
}
else if (backCamera != null)
{
Core.VideoDevice = backCamera;
}
}
}
/// <summary>
/// Enables disables video.
/// </summary>
......@@ -469,18 +496,22 @@ namespace Linphone.Model
void CoreListener.CallStateChanged(Call call, CallState state, string message)
{
Debug.WriteLine("Call state " + state);
CallStateText = message;
Debug.WriteLine("Call state " + message);
#pragma warning disable CS4014 // Dans la mesure où cet appel n'est pas attendu, l'exécution de la méthode actuelle continue avant la fin de l'appel
CoreDispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
CoreDispatcher.RunAsync(CoreDispatcherPriority.High, () =>
{
if (Changed != null)
{
Debug.WriteLine("CHANGED");
Changed(this, new CallEventArgs(call));
}
});
#pragma warning restore CS4014 // Dans la mesure où cet appel n'est pas attendu, l'exécution de la méthode actuelle continue avant la fin de l'appel
#pragma warning restore CS4014 // Dans la mesure où cet appel n'est pas attendu, l'exécution de la méthode actuelle continue avant la fin de l'appel
if (state == CallState.OutgoingProgress)
{
......@@ -498,7 +529,7 @@ namespace Linphone.Model
#pragma warning restore CS4014 // Dans la mesure où cet appel n'est pas attendu, l'exécution de la méthode actuelle continue avant la fin de l'appel
}
else if (state == CallState.IncomingReceived)
if (state == CallState.IncomingReceived)
{
#pragma warning disable CS4014 // Dans la mesure où cet appel n'est pas attendu, l'exécution de la méthode actuelle continue avant la fin de l'appel
CoreDispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
......@@ -572,7 +603,7 @@ namespace Linphone.Model
void CoreListener.CallStatsUpdated(Call call, CallStats stats)
{
System.Diagnostics.Debug.WriteLine("CallStatsUpdated");
//System.Diagnostics.Debug.WriteLine("CallStatsUpdated");
}
void CoreListener.DtmfReceived(Call call, char dtmf)
......
......@@ -25,5 +25,14 @@
<uap:Capability Name="contacts" />
<uap:Capability Name="voipCall" />
<DeviceCapability Name="microphone" />
<DeviceCapability Name="webcam" />
</Capabilities>
<Extensions>
<Extension Category="windows.activatableClass.inProcessServer">
<InProcessServer>
<Path>MSWinRTVideo.dll</Path>
<ActivatableClass ActivatableClassId="MSWinRTVideo.SchemeHandler" ThreadingModel="both" />
</InProcessServer>
</Extension>
</Extensions>
</Package>
\ No newline at end of file
......@@ -7,9 +7,10 @@
xmlns:linphone="using:Linphone.Views"
xmlns:controls="using:Linphone.Controls"
xmlns:custom="using:Linphone.Views"
Background="{ThemeResource AppBarBackgroundThemeBrush}"
mc:Ignorable="d">
<Grid x:Name="LayoutRoot" Background="{StaticResource AppBarBackgroundThemeBrush}" Tapped="LayoutRoot_Tap">
<Grid x:Name="LayoutRoot" Tapped="LayoutRoot_Tap">
<MediaElement
x:Name="remoteVideo"
Visibility="{Binding RemoteVideoVisibility}"
......@@ -32,50 +33,57 @@
<Grid x:Name="HUD"
HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Status text -->
<TextBlock
Grid.Row="0"
x:Name="Status"
Text="Dialing"
Margin="12,0,12,0"
FontSize="20" />
<Grid x:Name="ContactHeader" Margin="10,50,10,10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Image Source="/Assets/avatar2.png"
HorizontalAlignment="Center"
Width="50"/>
<!-- Contact text -->
<TextBlock
Grid.Row="1"
x:Name="Contact"
FontSize="20"
HorizontalAlignment="Center"
FontFamily="{ThemeResource PhoneFontFamilySemiLight}"
TextWrapping="Wrap"
Margin="12,0,12,0"/>
<TextBlock
Grid.Row="1"
x:Name="Contact"
FontSize="20"
HorizontalAlignment="Center"
Style="{StaticResource TextStyle}"
TextWrapping="Wrap"
Margin="5"/>
<!-- Number text -->
<TextBlock
Grid.Row="2"
x:Name="Number"
Margin="12,0,12,0"
FontSize="25"/>
<TextBlock
Grid.Row="2"
x:Name="Number"
Margin="5"
Visibility="Collapsed"
FontSize="25"/>
<TextBlock
Grid.Row="3"
x:Name="Status"
Text="Dialing ..."
x:Uid="Dialing"
Style="{StaticResource ListItemStyle}"
HorizontalAlignment="Center"
Margin="12,0,12,0"
FontSize="20" />
</Grid>
<controls:CallControlsP
x:Name="buttons"
VerticalAlignment="Bottom"
Visibility="Visible"
Grid.Row="3"/>
<controls:CallControlsL
x:Name="buttons_landscape"
Visibility="Collapsed"
Grid.Row="3"/>
Grid.Row="1"/>
<!-- Local video media element -->
<Grid Grid.RowSpan="4" Canvas.ZIndex="-1">
<Grid Grid.RowSpan="2" x:Name="VideoGrid" Canvas.ZIndex="-1" Background="Black" Visibility="Visible" Tapped="Video_Tapped">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
......@@ -88,22 +96,12 @@
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<MediaElement
x:Name="localVideo"
Grid.Row="3"
Grid.Column="2"
Visibility="{Binding LocalVideoVisibility}"
MediaOpened="localVideo_MediaOpened_1"
MediaFailed="localVideo_MediaFailed_1"
Source="{Binding LocalVideoUri}"
RenderTransformOrigin="0.5,0.5"
Stretch="Uniform"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<MediaElement.RenderTransform>
<CompositeTransform Rotation="{Binding LocalVideoRotation}" ScaleX="{Binding LocalVideoScaleX}"/>
</MediaElement.RenderTransform>
</MediaElement>
<SwapChainPanel x:Name="VideoSwapChainPanel" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3" Grid.RowSpan="3"/>
<SwapChainPanel x:Name="PreviewSwapChainPanel" Grid.Column="2" Grid.Row="2" Width="120" Height="160" RenderTransformOrigin="0.5,0.5">
<SwapChainPanel.RenderTransform>
<CompositeTransform ScaleX="-1"/>
</SwapChainPanel.RenderTransform>
</SwapChainPanel>
</Grid>
</Grid>
</Grid>
......
This diff is collapsed.
{
"dependencies": {
"LinphoneSDK": "3.9.1.375",
"LinphoneSDK": "3.9.1.826",
"Microsoft.ApplicationInsights": "2.0.1",
"Microsoft.ApplicationInsights.PersistenceChannel": "1.2.3",
"Microsoft.ApplicationInsights.WindowsApps": "1.1.1",
"Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0"
"Microsoft.NETCore.UniversalWindowsPlatform": "5.1.0"
},
"frameworks": {
"uap10.0": {}
......
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