├── .gitattributes
├── .gitignore
├── Client
├── App.xaml
├── App.xaml.cs
├── Assets
│ ├── Logo.scale-100.png
│ ├── Microphone-100.png
│ ├── No Microphone-100.png
│ ├── No Selfie-100.png
│ ├── No Video-100.png
│ ├── Phone Disconnected-100.png
│ ├── Phone-100.png
│ ├── Selfie-100.png
│ ├── Settings-100.png
│ ├── SmallLogo.scale-100.png
│ ├── SplashScreen.scale-100.png
│ ├── SplashScreen.scale-200.png
│ ├── Square150x150Logo.scale-200.png
│ ├── Square44x44Logo.scale-200.png
│ ├── Square44x44Logo.targetsize-24_altform-unplated.png
│ ├── StoreLogo.png
│ ├── Video-100.png
│ └── WideLogo.scale-100.png
├── MVVM
│ ├── BindableBase.cs
│ └── DispatcherBindableBase.cs
├── Main
│ ├── MainPage.xaml
│ └── MainPage.xaml.cs
├── Model
│ ├── IceServer.cs
│ └── Peer.cs
├── Ortc-Required
│ ├── AutoLock.cs
│ ├── Helper.cs
│ ├── Media.cs
│ ├── MediaDevice.cs
│ ├── ORTCStatsManager.cs
│ └── WebRTC.cs
├── Package.Ortc.appxmanifest
├── Package.WebRtc.appxmanifest
├── PeerConnectionClient.Ortc.csproj
├── PeerConnectionClient.Ortc_TemporaryKey.pfx
├── PeerConnectionClient.WebRtc.csproj
├── PeerConnectionClient.WebRtc_TemporaryKey.pfx
├── Properties
│ ├── AssemblyInfo.cs
│ └── Default.rd.xml
├── Utilities
│ ├── ActionCommand.cs
│ ├── BoolToVisConverter.cs
│ ├── InvertedBooleanConverter.cs
│ ├── NtpService.cs
│ ├── NullToVisibleConverter.cs
│ ├── SdpUtils.cs
│ ├── ToggleImageConverter.cs
│ ├── UI
│ │ ├── ErrorControl.xaml
│ │ └── ErrorControl.xaml.cs
│ ├── ValidableBase.cs
│ ├── ValidableIntegerString.cs
│ ├── ValidableNonEmptyString.cs
│ └── VideoCaptureFormat.cs
├── ViewModels
│ └── MainViewModel.cs
├── config.txt
└── ecc-key.p12
├── ClientCore
├── Config.cs
├── PeerConnectionClientCore.csproj
├── PeerConnectionClientUnityCore.csproj
├── Properties
│ ├── AssemblyInfo.cs
│ └── Default.rd.xml
├── Signalling
│ ├── Conductor.cs
│ └── Signalling.cs
├── Stats
│ ├── PeerConnectionStateChange.cs
│ ├── StatsController.cs
│ └── WebRtcStats.cs
└── Utilities
│ ├── AppPerf.cs
│ ├── SdpUtils.cs
│ └── XmlSerializer.cs
├── ClientUnity
├── Assets
│ ├── Materials.meta
│ ├── Materials
│ │ ├── CursorMaterial.mat
│ │ ├── CursorMaterial.mat.meta
│ │ ├── Default.mat
│ │ ├── Default.mat.meta
│ │ ├── EyeEffectShader.shader
│ │ ├── EyeEffectShader.shader.meta
│ │ ├── EyeMaterial.mat
│ │ └── EyeMaterial.mat.meta
│ ├── Models.meta
│ ├── Models
│ │ ├── Cursor.fbx
│ │ └── Cursor.fbx.meta
│ ├── Plugins.meta
│ ├── Plugins
│ │ ├── WSA.meta
│ │ └── WSA
│ │ │ ├── PeerConnectionClientCore.dll.meta
│ │ │ ├── PeerConnectionClientCore.pdb.meta
│ │ │ ├── x86.meta
│ │ │ └── x86
│ │ │ ├── MediaEngineUWP.dll.meta
│ │ │ ├── MediaEngineUWP.pdb.meta
│ │ │ ├── Org.WebRtc.dll.meta
│ │ │ ├── Org.WebRtc.pdb.meta
│ │ │ ├── Org.WebRtc.winmd.meta
│ │ │ ├── WebRtcScheme.dll.meta
│ │ │ ├── WebRtcScheme.pdb.meta
│ │ │ └── WebRtcScheme.winmd.meta
│ ├── Prefabs.meta
│ ├── Prefabs
│ │ ├── TextItemPreftab.prefab
│ │ └── TextItemPreftab.prefab.meta
│ ├── Scenes.meta
│ ├── Scenes
│ │ ├── PeerCCScene.unity
│ │ └── PeerCCScene.unity.meta
│ ├── Scripts.meta
│ ├── Scripts
│ │ ├── ControlScript.cs
│ │ ├── ControlScript.cs.meta
│ │ ├── GazeGestureManager.cs
│ │ ├── GazeGestureManager.cs.meta
│ │ ├── MouseLook.cs
│ │ ├── MouseLook.cs.meta
│ │ ├── WorldCursor.cs
│ │ └── WorldCursor.cs.meta
│ ├── Textures.meta
│ ├── Textures
│ │ ├── eyeTexture.png
│ │ ├── eyeTexture.png.meta
│ │ ├── webrtc-logo.png
│ │ └── webrtc-logo.png.meta
│ ├── WSATestCertificate.pfx
│ └── WSATestCertificate.pfx.meta
└── ProjectSettings
│ ├── AudioManager.asset
│ ├── ClusterInputManager.asset
│ ├── DynamicsManager.asset
│ ├── EditorBuildSettings.asset
│ ├── EditorSettings.asset
│ ├── GraphicsSettings.asset
│ ├── InputManager.asset
│ ├── NavMeshAreas.asset
│ ├── NetworkManager.asset
│ ├── Physics2DSettings.asset
│ ├── PresetManager.asset
│ ├── ProjectSettings.asset
│ ├── ProjectVersion.txt
│ ├── QualitySettings.asset
│ ├── TagManager.asset
│ ├── TimeManager.asset
│ ├── UnityConnectSettings.asset
│ ├── VFXManager.asset
│ └── XRSettings.asset
├── MediaEnginePlayerPlugin
├── .gitignore
├── MediaEngineUWP
│ ├── Shared
│ │ ├── MediaEngine.cpp
│ │ ├── MediaEngine.h
│ │ ├── MediaEnginePlayer.cpp
│ │ ├── MediaEnginePlayer.h
│ │ ├── MediaHelpers.cpp
│ │ ├── MediaHelpers.h
│ │ ├── Shared.vcxitems
│ │ ├── Shared.vcxitems.filters
│ │ ├── Unity
│ │ │ ├── IUnityGraphics.h
│ │ │ ├── IUnityGraphicsD3D11.h
│ │ │ ├── IUnityGraphicsD3D12.h
│ │ │ ├── IUnityGraphicsD3D9.h
│ │ │ ├── IUnityGraphicsMetal.h
│ │ │ ├── IUnityInterface.h
│ │ │ └── PlatformBase.h
│ │ ├── d3dmanagerlock.hxx
│ │ ├── dllmain.cpp
│ │ └── targetver.h
│ └── UWP
│ │ ├── MediaEngineUWP.vcxproj
│ │ ├── MediaEngineUWP.vcxproj.filters
│ │ └── MediaPlayback.def
└── WebRtcScheme
│ ├── SchemeHandler.cpp
│ ├── SchemeHandler.h
│ ├── WebRtcScheme.vcxproj
│ └── WebRtcScheme.vcxproj.filters
├── Org.WebRtc.Callstats
├── CallStats.cs
├── CallStatsClient.cs
├── Org.WebRtc.Callstats.csproj
├── Request
│ ├── ApplicationErrorLogsData.cs
│ ├── BridgeAliveData.cs
│ ├── BridgeStatisticsData.cs
│ ├── ConferenceStatsSubmissionData.cs
│ ├── ConferenceUserFeedbackData.cs
│ ├── ConnectedOrActiveDevicesData.cs
│ ├── CreateConferenceData.cs
│ ├── DominantSpeakerData.cs
│ ├── FabricActionData.cs
│ ├── FabricDroppedData.cs
│ ├── FabricSetupData.cs
│ ├── FabricSetupFailedData.cs
│ ├── FabricStateChangeData.cs
│ ├── FabricTerminatedData.cs
│ ├── FabricTransportChangeData.cs
│ ├── IceAbortedData.cs
│ ├── IceCandidate.cs
│ ├── IceCandidatePair.cs
│ ├── IceConnectionDisruptionEndData.cs
│ ├── IceConnectionDisruptionStartData.cs
│ ├── IceDisruptionEndData.cs
│ ├── IceDisruptionStartData.cs
│ ├── IceFailedData.cs
│ ├── IceRestartData.cs
│ ├── IceTerminatedData.cs
│ ├── MediaActionData.cs
│ ├── MediaPlaybackData.cs
│ ├── SDPEventData.cs
│ ├── SSRCMapData.cs
│ ├── SystemStatusStatsSubmissionData.cs
│ ├── UserAliveData.cs
│ ├── UserDetailsData.cs
│ └── UserLeftData.cs
└── Response
│ ├── AuthenticationResponse.cs
│ └── ConferenceResponse.cs
└── README.md
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 |
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | bin/
2 | obj/
3 | packages/
4 | *.suo
5 | *.csproj.user
6 | project.lock.json
7 | *.sdf
8 | *.bak
9 | ClientUnity/Assets/Plugins/WSA/*.dll
10 | ClientUnity/Assets/Plugins/WSA/*.pdb
11 | ClientUnity/Assets/Plugins/WSA/x86/*.dll
12 | ClientUnity/Assets/Plugins/WSA/x86/*.winmd
13 | ClientUnity/Assets/Plugins/WSA/x86/*.pdb
14 | ClientUnity/Assets/Plugins/WSA/x64/*.dll
15 | ClientUnity/Assets/Plugins/WSA/x64/*.winmd
16 | ClientUnity/Assets/Plugins/WSA/x64/*.pdb
17 | ClientUnity/Assets/Plugins/WSA/arm/*.dll
18 | ClientUnity/Assets/Plugins/WSA/arm/*.winmd
19 | ClientUnity/Assets/Plugins/WSA/arm/*.pdb
20 | ClientUnity/Library
21 | ClientUnity/*.sln
22 | ClientUnity/*.csproj
23 | ClientUnity/.vs
24 | ClientUnity/Temp
25 |
--------------------------------------------------------------------------------
/Client/App.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Client/Assets/Logo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/webrtc-uwp/PeerCC/9bcdc04a9d0d8f8b66e313272312ebb608154aa0/Client/Assets/Logo.scale-100.png
--------------------------------------------------------------------------------
/Client/Assets/Microphone-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/webrtc-uwp/PeerCC/9bcdc04a9d0d8f8b66e313272312ebb608154aa0/Client/Assets/Microphone-100.png
--------------------------------------------------------------------------------
/Client/Assets/No Microphone-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/webrtc-uwp/PeerCC/9bcdc04a9d0d8f8b66e313272312ebb608154aa0/Client/Assets/No Microphone-100.png
--------------------------------------------------------------------------------
/Client/Assets/No Selfie-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/webrtc-uwp/PeerCC/9bcdc04a9d0d8f8b66e313272312ebb608154aa0/Client/Assets/No Selfie-100.png
--------------------------------------------------------------------------------
/Client/Assets/No Video-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/webrtc-uwp/PeerCC/9bcdc04a9d0d8f8b66e313272312ebb608154aa0/Client/Assets/No Video-100.png
--------------------------------------------------------------------------------
/Client/Assets/Phone Disconnected-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/webrtc-uwp/PeerCC/9bcdc04a9d0d8f8b66e313272312ebb608154aa0/Client/Assets/Phone Disconnected-100.png
--------------------------------------------------------------------------------
/Client/Assets/Phone-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/webrtc-uwp/PeerCC/9bcdc04a9d0d8f8b66e313272312ebb608154aa0/Client/Assets/Phone-100.png
--------------------------------------------------------------------------------
/Client/Assets/Selfie-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/webrtc-uwp/PeerCC/9bcdc04a9d0d8f8b66e313272312ebb608154aa0/Client/Assets/Selfie-100.png
--------------------------------------------------------------------------------
/Client/Assets/Settings-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/webrtc-uwp/PeerCC/9bcdc04a9d0d8f8b66e313272312ebb608154aa0/Client/Assets/Settings-100.png
--------------------------------------------------------------------------------
/Client/Assets/SmallLogo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/webrtc-uwp/PeerCC/9bcdc04a9d0d8f8b66e313272312ebb608154aa0/Client/Assets/SmallLogo.scale-100.png
--------------------------------------------------------------------------------
/Client/Assets/SplashScreen.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/webrtc-uwp/PeerCC/9bcdc04a9d0d8f8b66e313272312ebb608154aa0/Client/Assets/SplashScreen.scale-100.png
--------------------------------------------------------------------------------
/Client/Assets/SplashScreen.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/webrtc-uwp/PeerCC/9bcdc04a9d0d8f8b66e313272312ebb608154aa0/Client/Assets/SplashScreen.scale-200.png
--------------------------------------------------------------------------------
/Client/Assets/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/webrtc-uwp/PeerCC/9bcdc04a9d0d8f8b66e313272312ebb608154aa0/Client/Assets/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Client/Assets/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/webrtc-uwp/PeerCC/9bcdc04a9d0d8f8b66e313272312ebb608154aa0/Client/Assets/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/Client/Assets/Square44x44Logo.targetsize-24_altform-unplated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/webrtc-uwp/PeerCC/9bcdc04a9d0d8f8b66e313272312ebb608154aa0/Client/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
--------------------------------------------------------------------------------
/Client/Assets/StoreLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/webrtc-uwp/PeerCC/9bcdc04a9d0d8f8b66e313272312ebb608154aa0/Client/Assets/StoreLogo.png
--------------------------------------------------------------------------------
/Client/Assets/Video-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/webrtc-uwp/PeerCC/9bcdc04a9d0d8f8b66e313272312ebb608154aa0/Client/Assets/Video-100.png
--------------------------------------------------------------------------------
/Client/Assets/WideLogo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/webrtc-uwp/PeerCC/9bcdc04a9d0d8f8b66e313272312ebb608154aa0/Client/Assets/WideLogo.scale-100.png
--------------------------------------------------------------------------------
/Client/MVVM/BindableBase.cs:
--------------------------------------------------------------------------------
1 | //*********************************************************
2 | //
3 | // Copyright (c) Microsoft. All rights reserved.
4 | // This code is licensed under the MIT License (MIT).
5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
9 | //
10 | //*********************************************************
11 |
12 | using System;
13 | using System.ComponentModel;
14 | using System.Linq.Expressions;
15 | using System.Reflection;
16 | using System.Runtime.CompilerServices;
17 |
18 | namespace PeerConnectionClient.MVVM
19 | {
20 | ///
21 | /// The BindableBase class of the MVVM pattern.
22 | ///
23 | public abstract class BindableBase : INotifyPropertyChanged
24 | {
25 | public event PropertyChangedEventHandler PropertyChanged;
26 |
27 | ///
28 | /// Checks if a property already matches a desired value. Sets the property and notifies listeners only when necessary.
29 | ///
30 | /// The type of the property.
31 | /// Reference to a property with both getter and setter.
32 | /// Desired value for the property.
33 | /// Name of the property used to notify listeners.
34 | /// True if the value was changed, false if the existing value matched the desired value.
35 | protected virtual bool SetProperty(ref T storage, T value, [CallerMemberName] string propertyName = null)
36 | {
37 | if (Equals(storage, value))
38 | {
39 | return false;
40 | }
41 | storage = value;
42 | OnPropertyChanged(propertyName);
43 | return true;
44 | }
45 |
46 | ///
47 | /// Notifies listeners that a property value has changed.
48 | ///
49 | /// Name of the property used to notify listeners.
50 | protected virtual void OnPropertyChanged(string propertyName)
51 | {
52 | var changedEventHandler = PropertyChanged;
53 | if (changedEventHandler == null)
54 | {
55 | return;
56 | }
57 | changedEventHandler(this, new PropertyChangedEventArgs(propertyName));
58 | }
59 |
60 | ///
61 | /// Raises this object's PropertyChanged event.
62 | ///
63 | /// The type of the property that has a new value.
64 | /// A Lambda expression representing the property that has a new value.
65 | protected void OnPropertyChanged(Expression> propertyExpression)
66 | {
67 | OnPropertyChanged(GetPropertyName(propertyExpression));
68 | }
69 |
70 | ///
71 | /// Returns the name of a property identified by a lambda expression.
72 | ///
73 | /// The type of the property
74 | /// A lambda expression selecting the property.
75 | /// The name of the property accessed by expression.
76 | private static string GetPropertyName(Expression> propertyExpression)
77 | {
78 | if (propertyExpression == null)
79 | {
80 | throw new ArgumentNullException("propertyExpression");
81 | }
82 |
83 | var memberExpression = propertyExpression.Body as MemberExpression;
84 | if (memberExpression == null)
85 | {
86 | throw new ArgumentException("propertyExpression");
87 | }
88 |
89 | var propertyInfo = memberExpression.Member as PropertyInfo;
90 | if (propertyInfo == null)
91 | {
92 | throw new ArgumentException("propertyExpression");
93 | }
94 |
95 | if (propertyInfo.GetMethod.IsStatic)
96 | {
97 | throw new ArgumentException("propertyExpression");
98 | }
99 |
100 | return memberExpression.Member.Name;
101 | }
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/Client/MVVM/DispatcherBindableBase.cs:
--------------------------------------------------------------------------------
1 | //*********************************************************
2 | //
3 | // Copyright (c) Microsoft. All rights reserved.
4 | // This code is licensed under the MIT License (MIT).
5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
9 | //
10 | //*********************************************************
11 |
12 | using System;
13 | using Windows.UI.Core;
14 |
15 | namespace PeerConnectionClient.MVVM
16 | {
17 | ///
18 | /// Provides ability to run the UI updates in UI thread.
19 | ///
20 | public abstract class DispatcherBindableBase : BindableBase
21 | {
22 | // The UI dispatcher
23 | private readonly CoreDispatcher _uiDispatcher;
24 |
25 | ///
26 | /// Creates a DispatcherBindableBase instance.
27 | ///
28 | /// Core event message dispatcher.
29 | protected DispatcherBindableBase(CoreDispatcher uiDispatcher)
30 | {
31 | _uiDispatcher = uiDispatcher;
32 | }
33 |
34 | ///
35 | /// Overrides the BindableBase's OnPropertyChanged method.
36 | ///
37 | /// The name of the changed property.
38 | protected override void OnPropertyChanged(string propertyName)
39 | {
40 | RunOnUiThread(()=> base.OnPropertyChanged(propertyName));
41 | }
42 |
43 | ///
44 | /// Schedules the provided callback on the UI thread from a worker thread, and
45 | // returns the results asynchronously.
46 | ///
47 | /// The function to execute
48 | protected void RunOnUiThread(Action fn)
49 | {
50 | var asyncOp = _uiDispatcher.RunAsync(CoreDispatcherPriority.Normal, new DispatchedHandler(fn));
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Client/Main/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | //*********************************************************
2 | //
3 | // Copyright (c) Microsoft. All rights reserved.
4 | // This code is licensed under the MIT License (MIT).
5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
9 | //
10 | //*********************************************************
11 |
12 | using PeerConnectionClient.ViewModels;
13 | using System;
14 | using System.Collections.Generic;
15 | using System.IO;
16 | using System.Linq;
17 | using System.Runtime.InteropServices.WindowsRuntime;
18 | using Windows.Foundation;
19 | using Windows.Foundation.Collections;
20 | using Windows.UI.Xaml;
21 | using Windows.UI.Xaml.Controls;
22 | using Windows.UI.Xaml.Controls.Primitives;
23 | using Windows.UI.Xaml.Data;
24 | using Windows.UI.Xaml.Input;
25 | using Windows.UI.Xaml.Media;
26 | using Windows.UI.Xaml.Navigation;
27 |
28 | namespace PeerConnectionClient
29 | {
30 | ///
31 | /// The application main page.
32 | ///
33 | public sealed partial class MainPage : Page
34 | {
35 | private MainViewModel _mainViewModel;
36 |
37 | ///
38 | /// Constructor.
39 | ///
40 | public MainPage()
41 | {
42 | this.InitializeComponent();
43 | }
44 |
45 | ///
46 | /// See Page.OnNavigatedTo()
47 | ///
48 | protected override void OnNavigatedTo(NavigationEventArgs e)
49 | {
50 | _mainViewModel = (MainViewModel)e.Parameter;
51 | this.DataContext = _mainViewModel;
52 | _mainViewModel.PeerVideo = PeerVideo;
53 | _mainViewModel.SelfVideo = SelfVideo;
54 | }
55 |
56 | ///
57 | /// Invoked when the Add button is clicked
58 | ///
59 | /// The object where the handler is attached.
60 | /// Details about the exception routed event.
61 | private void ConfirmAddButton_Click(object sender, RoutedEventArgs e)
62 | {
63 | this.AddButton.Flyout.Hide();
64 | }
65 |
66 | ///
67 | /// Media Failed event handler for remote/peer video.
68 | /// Invoked when an error occurs in peer media source.
69 | ///
70 | /// The object where the handler is attached.
71 | /// Details about the exception routed event.
72 | private void PeerVideo_MediaFailed(object sender, Windows.UI.Xaml.ExceptionRoutedEventArgs e)
73 | {
74 | if(_mainViewModel!=null)
75 | {
76 | _mainViewModel.PeerVideo_MediaFailed(sender, e);
77 | }
78 | }
79 |
80 | ///
81 | /// Media Failed event handler for self video.
82 | /// Invoked when an error occurs in self media source.
83 | ///
84 | /// The object where the handler is attached.
85 | /// Details about the exception routed event.
86 | private void SelfVideo_MediaFailed(object sender, Windows.UI.Xaml.ExceptionRoutedEventArgs e)
87 | {
88 | if (_mainViewModel != null)
89 | {
90 | _mainViewModel.SelfVideo_MediaFailed(sender, e);
91 | }
92 | }
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/Client/Model/IceServer.cs:
--------------------------------------------------------------------------------
1 | //*********************************************************
2 | //
3 | // Copyright (c) Microsoft. All rights reserved.
4 | // This code is licensed under the MIT License (MIT).
5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
9 | //
10 | //*********************************************************
11 |
12 | using System;
13 | using System.Collections.Generic;
14 | using System.ComponentModel;
15 | using System.Linq;
16 | using System.Xml.Serialization;
17 | using PeerConnectionClient.MVVM;
18 | using PeerConnectionClient.Utilities;
19 |
20 | namespace PeerConnectionClient.Model
21 | {
22 | ///
23 | /// Class represents an Ice server
24 | ///
25 | public class IceServer : BindableBase
26 | {
27 | ///
28 | /// Default constructor for Ice server.
29 | ///
30 | public IceServer() : this(string.Empty, ServerType.STUN)
31 | {
32 | }
33 |
34 | ///
35 | /// Creates an Ice server with specified host, port and server type.
36 | ///
37 | /// The host name of the Ice server.
38 | /// The type of the Ice server.
39 | public IceServer(string host, ServerType type)
40 | {
41 | Host.PropertyChanged += ValidableProperties_PropertyChanged;
42 | Host.Value = host;
43 | Type = type;
44 | }
45 |
46 | public enum ServerType { STUN, TURN };
47 |
48 | ///
49 | /// Make the enumerable available in XAML.
50 | ///
51 | [XmlIgnore]
52 | public IEnumerable Types
53 | {
54 | get
55 | {
56 | return Enum.GetValues(typeof(ServerType)).Cast();
57 | }
58 | }
59 |
60 | protected ServerType _type;
61 |
62 | ///
63 | /// Ice server type property.
64 | ///
65 | public ServerType Type
66 | {
67 | get
68 | {
69 | return _type;
70 | }
71 | set
72 | {
73 | switch (value)
74 | {
75 | case ServerType.STUN:
76 | _typeStr = "stun";
77 | break;
78 | case ServerType.TURN:
79 | _typeStr = "turn";
80 | break;
81 | default:
82 | _typeStr = "unknown";
83 | break;
84 | }
85 | _type = value;
86 | }
87 | }
88 |
89 | protected string _typeStr;
90 |
91 | ///
92 | /// Ice server type string property.
93 | ///
94 | public string TypeStr
95 | {
96 | get { return _typeStr; }
97 | }
98 |
99 | ///
100 | /// Ice server's host and port.
101 | ///
102 | [XmlIgnore]
103 | public string HostAndPort
104 | {
105 | get { return string.Format("{0}", Host.Value); }
106 | }
107 |
108 | private ValidableIntegerString _port = new ValidableIntegerString(0, 65535);
109 |
110 | ///
111 | /// The Ice server's password.
112 | /// Used with the Username below to connect to the Ice server.
113 | ///
114 | public string Credential { get; set; }
115 |
116 | protected ValidableNonEmptyString _host = new ValidableNonEmptyString();
117 |
118 | ///
119 | /// Ice server's host (IP).
120 | ///
121 | public ValidableNonEmptyString Host
122 | {
123 | get { return _host; }
124 | set { _host = value; }
125 | }
126 |
127 | ///
128 | /// Username for the Ice server.
129 | ///
130 | public string Username { get; set; }
131 |
132 | [XmlIgnore]
133 | protected bool _valid;
134 |
135 | ///
136 | /// Property to check the validity of Ice server information.
137 | ///
138 | [XmlIgnore]
139 | public bool Valid
140 | {
141 | get { return _valid; }
142 | set { SetProperty(ref _valid, value); }
143 | }
144 |
145 |
146 | ///
147 | /// Invokes when a property of an Ice server is changed and
148 | /// the new information needs validation.
149 | ///
150 | /// Information about event sender.
151 | /// Details about Property changed event.
152 | void ValidableProperties_PropertyChanged(object sender, PropertyChangedEventArgs e)
153 | {
154 | if (e.PropertyName == "Valid")
155 | {
156 | Valid = Host.Valid;
157 | }
158 | }
159 | }
160 | }
161 |
--------------------------------------------------------------------------------
/Client/Model/Peer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace PeerConnectionClient.Model
6 | {
7 | class Peer
8 | {
9 | public int Id { get; set; }
10 | public string Name { get; set; }
11 |
12 | public override string ToString()
13 | {
14 | return Id + ": " + Name;
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Client/Ortc-Required/AutoLock.cs:
--------------------------------------------------------------------------------
1 | //*********************************************************
2 | //
3 | // Copyright (c) Microsoft. All rights reserved.
4 | // This code is licensed under the MIT License (MIT).
5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
9 | //
10 | //*********************************************************
11 |
12 | using System;
13 | using System.Diagnostics;
14 | using System.Threading;
15 | using System.Threading.Tasks;
16 |
17 | namespace PeerConnectionClient.Ortc.Utilities
18 | {
19 | internal class AutoLock : IDisposable
20 | {
21 | private readonly SemaphoreSlim _sem;
22 | private bool _isLocked;
23 |
24 | public AutoLock(SemaphoreSlim sem)
25 | {
26 | _sem = sem;
27 | }
28 |
29 | public Task WaitAsync()
30 | {
31 | if (_isLocked) return Task.Run(() => { });
32 | _isLocked = true;
33 | var result = _sem.WaitAsync();
34 | return result;
35 | }
36 |
37 | public void Dispose()
38 | {
39 | if (_isLocked)
40 | {
41 | _sem.Release();
42 | }
43 | }
44 | }
45 | }
--------------------------------------------------------------------------------
/Client/Ortc-Required/Media.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Windows.Foundation;
7 | using Windows.Media.Core;
8 | using Org.Ortc;
9 | using System.ComponentModel;
10 | using System.Runtime.CompilerServices;
11 | using System.Threading;
12 | using Org.Ortc.Adapter;
13 | using PeerConnectionClient.Ortc.Utilities;
14 |
15 | namespace PeerConnectionClient.Ortc
16 | {
17 | public class RTCPeerConnectionHealthStats
18 | {
19 | }
20 | public class MediaStreamEvent
21 | {
22 | public MediaStream Stream;
23 | }
24 |
25 | public class RTCMediaStreamConstraints
26 | {
27 | public Boolean audioEnabled;
28 | public Boolean videoEnabled;
29 | }
30 | public class Media
31 | {
32 | private readonly SemaphoreSlim _lock = new SemaphoreSlim(1, 1);
33 |
34 | private MediaDevice _audioCaptureDevice;
35 | private MediaDevice _videoDevice;
36 | private int _preferredFrameWidth;
37 | private int _preferredFrameHeight;
38 | private int _preferredFPS;
39 |
40 | public delegate void OnMediaCaptureDeviceFoundDelegate(MediaDevice param0);
41 |
42 | public static Media CreateMedia()
43 | {
44 | var ret = new Media();
45 |
46 | return ret;
47 | }
48 |
49 | public static IAsyncOperation CreateMediaAsync()
50 | {
51 | return Task.Run(() => CreateMedia()).AsAsyncOperation();
52 | }
53 |
54 | public Task> GetUserMedia(RTCMediaStreamConstraints mediaStreamConstraints)
55 | {
56 | return Task.Run(() =>
57 | {
58 | var constraints = Helper.MakeConstraints(mediaStreamConstraints.audioEnabled, null,
59 | MediaDeviceKind.AudioInput, _audioCaptureDevice);
60 | constraints = Helper.MakeConstraints(mediaStreamConstraints.videoEnabled, constraints,
61 | MediaDeviceKind.VideoInput, _videoDevice);
62 | if (constraints.Video != null && constraints.Video.Advanced.Count > 0)
63 | {
64 | var constraintSet = constraints.Video.Advanced.First();
65 | constraintSet.Width = new ConstrainLong { Value = _preferredFrameWidth };
66 | constraintSet.Height = new ConstrainLong { Value = _preferredFrameHeight };
67 | constraintSet.FrameRate = new ConstrainDouble { Value = _preferredFPS };
68 | }
69 |
70 | var task = MediaDevices.GetUserMedia(constraints).AsTask();
71 | return task.Result;
72 | });
73 | }
74 |
75 | #if MISSING_CREATE_MEDIA
76 | public IMediaSource CreateMediaSource(MediaStreamTrack track, string id)
77 | {
78 | return track?.CreateMediaSource();
79 | }
80 | #endif
81 |
82 | public static void OnAppSuspending()
83 | {
84 | //MediaDevices.OnAppSuspending();
85 | }
86 |
87 | public void SelectAudioCaptureDevice(MediaDevice device)
88 | {
89 | using (var @lock = new AutoLock(_lock))
90 | {
91 | @lock.WaitAsync().Wait();
92 | _audioCaptureDevice = device;
93 | }
94 | }
95 |
96 | public void SelectVideoDevice(MediaDevice device)
97 | {
98 | using (var @lock = new AutoLock(_lock))
99 | {
100 | @lock.WaitAsync().Wait();
101 | _videoDevice = device;
102 | }
103 | }
104 |
105 | public void SetPreferredVideoCaptureFormat(int frameWidth, int frameHeight, int fps)
106 | {
107 | using (var @lock = new AutoLock(_lock))
108 | {
109 | @lock.WaitAsync().Wait();
110 | _preferredFrameWidth = frameWidth;
111 | _preferredFrameHeight = frameHeight;
112 | _preferredFPS = fps;
113 | }
114 | }
115 | }
116 | }
--------------------------------------------------------------------------------
/Client/Ortc-Required/MediaDevice.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Windows.Foundation;
7 | using Windows.Media.Core;
8 | using Windows.Media.MediaProperties;
9 | using Windows.Media.Capture;
10 |
11 | namespace PeerConnectionClient.Ortc
12 | {
13 | public class CaptureCapability
14 | {
15 | public uint Width { get; set; }
16 | public uint Height { get; set; }
17 | public uint FrameRate { get; set; }
18 | public String FullDescription { get; set; }
19 | public String ResolutionDescription { get; set; }
20 | public String FrameRateDescription { get; set; }
21 | public MediaRatio PixelAspectRatio { get; set; }
22 | }
23 | public class MediaDevice
24 | {
25 | public string Id { get; set; }
26 | public string Name { get; set; }
27 |
28 | public IAsyncOperation> GetVideoCaptureCapabilities()
29 | {
30 | MediaDevice device = this;
31 | return Task.Run(async () =>
32 | {
33 | var settings = new MediaCaptureInitializationSettings()
34 | {
35 | VideoDeviceId = device.Id,
36 | MediaCategory = MediaCategory.Communications,
37 | };
38 | using (var capture = new MediaCapture())
39 | {
40 | await capture.InitializeAsync(settings);
41 | var caps =
42 | capture.VideoDeviceController.GetAvailableMediaStreamProperties(
43 | MediaStreamType.VideoRecord);
44 |
45 | var arr = new List();
46 | foreach (var cap in caps)
47 | {
48 | if (cap.Type != "Video")
49 | {
50 | continue;
51 | }
52 |
53 | var videoCap = (VideoEncodingProperties) cap;
54 |
55 | if (videoCap.FrameRate.Denominator == 0 ||
56 | videoCap.FrameRate.Numerator == 0 ||
57 | videoCap.Width == 0 ||
58 | videoCap.Height == 0)
59 | {
60 | continue;
61 | }
62 | var captureCap = new CaptureCapability()
63 | {
64 | Width = videoCap.Width,
65 | Height = videoCap.Height,
66 | FrameRate = videoCap.FrameRate.Numerator/videoCap.FrameRate.Denominator,
67 | };
68 | captureCap.FrameRateDescription = $"{captureCap.FrameRate} fps";
69 | captureCap.ResolutionDescription = $"{captureCap.Width} x {captureCap.Height}";
70 | /*captureCap.PixelAspectRatio = new MediaRatio()
71 | {
72 | Numerator = videoCap.PixelAspectRatio.Numerator,
73 | Denominator = videoCap.PixelAspectRatio.Denominator,
74 | };*/
75 | captureCap.FullDescription =
76 | $"{captureCap.ResolutionDescription} {captureCap.FrameRateDescription}";
77 | arr.Add(captureCap);
78 | }
79 | return arr.GroupBy(o => o.FullDescription).Select(o => o.First()).ToList();
80 | }
81 | }).AsAsyncOperation();
82 | }
83 | }
84 | }
--------------------------------------------------------------------------------
/Client/Ortc-Required/WebRTC.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Runtime;
7 | using Windows.UI.Core;
8 | using Windows.Storage;
9 | using Windows.Foundation;
10 | using Windows.Media.Capture;
11 | using Org.Ortc;
12 | using PeerConnectionClient.Ortc.Utilities;
13 |
14 | namespace PeerConnectionClient.Utilities
15 | {
16 | public enum LogLevel
17 | {
18 | LOGLVL_SENSITIVE = 0,
19 | LOGLVL_VERBOSE = 1,
20 | LOGLVL_INFO = 2,
21 | LOGLVL_WARNING = 3,
22 | LOGLVL_ERROR = 4
23 | }
24 |
25 | public class WebRTC
26 | {
27 | public static void DisableLogging()
28 | {
29 |
30 | }
31 |
32 | public static void EnableLogging(LogLevel level)
33 | {
34 |
35 | }
36 |
37 | public static IList GetAudioCodecs()
38 | {
39 | return Helper.GetCodecs("audio");
40 | }
41 |
42 | //public static double GetCPUUsage();
43 | //public static long GetMemUsage();
44 | public static IList GetVideoCodecs()
45 | {
46 | return Helper.GetCodecs("video");
47 | }
48 |
49 | public static void Initialize(CoreDispatcher dispatcher)
50 | {
51 | Settings.ApplyDefaults();
52 |
53 | OrtcLib.Setup(EventQueueMaker.Bind(dispatcher));
54 | }
55 |
56 | //public static bool IsTracing();
57 | public static string LogFileName()
58 | {
59 | return "";
60 | }
61 |
62 | public static StorageFolder LogFolder()
63 | {
64 | return null;
65 | }
66 |
67 | private static async Task RequestAccessForMediaCapturePrivate() //async
68 | {
69 | MediaCapture mediaAccessRequester = new MediaCapture();
70 | MediaCaptureInitializationSettings mediaSettings = new MediaCaptureInitializationSettings
71 | {
72 | AudioDeviceId = "",
73 | VideoDeviceId = "",
74 | StreamingCaptureMode = StreamingCaptureMode.AudioAndVideo,
75 | PhotoCaptureSource = PhotoCaptureSource.VideoPreview
76 | };
77 |
78 | await mediaAccessRequester.InitializeAsync(mediaSettings);
79 |
80 | if (mediaAccessRequester.MediaCaptureSettings.VideoDeviceId != "" &&
81 | mediaAccessRequester.MediaCaptureSettings.AudioDeviceId != "")
82 | {
83 | return true;
84 | }
85 |
86 | return false;
87 | }
88 |
89 | public static IAsyncOperation RequestAccessForMediaCapture()
90 | {
91 | return RequestAccessForMediaCapturePrivate().AsAsyncOperation();
92 | }
93 |
94 | //[Overload("SaveTrace2")]
95 | //public static bool SaveTrace(string filename);
96 | //[Overload("SaveTrace1")]
97 | public static bool SaveTrace(string host, int port)
98 | {
99 | return false;
100 | }
101 |
102 | public static void SetPreferredVideoCaptureFormat(int frameWidth, int frameHeight, int fps)
103 | {
104 |
105 | }
106 |
107 | public static void StartTracing()
108 | {
109 |
110 | }
111 |
112 | public static void StopTracing()
113 | {
114 |
115 | }
116 |
117 | public static void UpdateCPUUsage(double cpuUsage)
118 | {
119 |
120 | }
121 |
122 | public static void UpdateMemUsage(long memUsage)
123 | {
124 |
125 | }
126 |
127 | ///
128 | /// CPU usage statistics data (in percents). Should be set by application.
129 | ///
130 | public static double CpuUsage { get; set; }
131 |
132 | ///
133 | /// Memory usage statistics data (in bytes). Should be set by application.
134 | ///
135 | public static Int64 MemoryUsage { get; set; }
136 | }
137 |
138 | }
--------------------------------------------------------------------------------
/Client/Package.Ortc.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | PeerConnectionClient.Ortc
7 | Optical Tone Ltd.
8 | Assets\StoreLogo.png
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/Client/Package.WebRtc.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | PeerConnectionClient.WebRtc
7 | Optical Tone Ltd.
8 | Assets\StoreLogo.png
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/Client/PeerConnectionClient.Ortc_TemporaryKey.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/webrtc-uwp/PeerCC/9bcdc04a9d0d8f8b66e313272312ebb608154aa0/Client/PeerConnectionClient.Ortc_TemporaryKey.pfx
--------------------------------------------------------------------------------
/Client/PeerConnectionClient.WebRtc_TemporaryKey.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/webrtc-uwp/PeerCC/9bcdc04a9d0d8f8b66e313272312ebb608154aa0/Client/PeerConnectionClient.WebRtc_TemporaryKey.pfx
--------------------------------------------------------------------------------
/Client/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("PeerConnectionClient")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("PeerConnectionClient")]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Version information for an assembly consists of the following four values:
18 | //
19 | // Major Version
20 | // Minor Version
21 | // Build Number
22 | // Revision
23 | //
24 | // You can specify all the values or you can default the Build and Revision Numbers
25 | // by using the '*' as shown below:
26 | // [assembly: AssemblyVersion("1.0.*")]
27 | [assembly: AssemblyVersion("1.0.0.0")]
28 | [assembly: AssemblyFileVersion("1.0.0.0")]
29 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/Client/Properties/Default.rd.xml:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Client/Utilities/ActionCommand.cs:
--------------------------------------------------------------------------------
1 | //*********************************************************
2 | //
3 | // Copyright (c) Microsoft. All rights reserved.
4 | // This code is licensed under the MIT License (MIT).
5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
9 | //
10 | //*********************************************************
11 |
12 | using System;
13 | using System.Windows.Input;
14 |
15 | namespace PeerConnectionClient.Utilities
16 | {
17 | ///
18 | /// Defines an action command.
19 | ///
20 | public class ActionCommand : ICommand
21 | {
22 | public delegate bool CanExecuteDelegate(object parameter);
23 |
24 | private readonly Action