it broke
This commit is contained in:
@@ -2,6 +2,10 @@
|
|||||||
using RelayClient.Models;
|
using RelayClient.Models;
|
||||||
using WebSocketSharp;
|
using WebSocketSharp;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.MixedReality.WebRTC;
|
||||||
|
using System.IO;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace RelayClient;
|
namespace RelayClient;
|
||||||
|
|
||||||
@@ -39,6 +43,8 @@ public partial class MainPage : ContentPage
|
|||||||
_wsc.Send($"REGISTER_KEY|{_username}|{publicKey}");
|
_wsc.Send($"REGISTER_KEY|{_username}|{publicKey}");
|
||||||
_wsc.Send("GET_SERVER_KEY");
|
_wsc.Send("GET_SERVER_KEY");
|
||||||
_wsc.Send("GET_CHANNELS");
|
_wsc.Send("GET_CHANNELS");
|
||||||
|
|
||||||
|
webRTCTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendButton_OnClicked(object? sender, EventArgs e)
|
private void SendButton_OnClicked(object? sender, EventArgs e)
|
||||||
@@ -286,4 +292,69 @@ public partial class MainPage : ContentPage
|
|||||||
MessagesLayout.Children.Add(bubble);
|
MessagesLayout.Children.Add(bubble);
|
||||||
await MessagesScrollView.ScrollToAsync(MessagesLayout, ScrollToPosition.End, true);
|
await MessagesScrollView.ScrollToAsync(MessagesLayout, ScrollToPosition.End, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task webRTCTest()
|
||||||
|
{
|
||||||
|
// var path = "D:\\DDI\\Relay\\RelayChat\\RelayCore\\RelayClient\\bin\\debug.txt";
|
||||||
|
// AudioTrackSource microphoneSource = null;
|
||||||
|
// VideoTrackSource webcamSource = null;
|
||||||
|
// Transceiver audioTransceiver = null;
|
||||||
|
// Transceiver videoTransceiver = null;
|
||||||
|
// LocalAudioTrack localAudioTrack = null;
|
||||||
|
// LocalVideoTrack localVideoTrack = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var deviceList = await DeviceVideoTrackSource.GetCaptureDevicesAsync();
|
||||||
|
string devices = "";
|
||||||
|
foreach (var device in deviceList)
|
||||||
|
{
|
||||||
|
devices += $"Found device: {device.name} (id: {device.id})\n";
|
||||||
|
Console.WriteLine($"Found device: {device.name} (id: {device.id})");
|
||||||
|
}
|
||||||
|
File.WriteAllText(path, devices);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
File.WriteAllText(path, e.Message);
|
||||||
|
Console.WriteLine(e);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
using var pc = new PeerConnection();
|
||||||
|
var config = new PeerConnectionConfiguration
|
||||||
|
{
|
||||||
|
IceServers = new List<IceServer>
|
||||||
|
{
|
||||||
|
new IceServer { Urls = { "stun:stun.l.google.com:19302" } }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
await pc.InitializeAsync(config);
|
||||||
|
|
||||||
|
// webcamSource = await DeviceVideoTrackSource.CreateAsync();
|
||||||
|
// var videoTrackConfig = new LocalVideoTrackInitConfig
|
||||||
|
// {
|
||||||
|
// trackName = "webcam_track"
|
||||||
|
// };
|
||||||
|
// localVideoTrack = LocalVideoTrack.CreateFromSource(webcamSource, videoTrackConfig);
|
||||||
|
// microphoneSource = await DeviceAudioTrackSource.CreateAsync();
|
||||||
|
// var audioTrackConfig = new LocalAudioTrackInitConfig
|
||||||
|
// {
|
||||||
|
// trackName = "microphone_track"
|
||||||
|
// };
|
||||||
|
// localAudioTrack = LocalAudioTrack.CreateFromSource(microphoneSource, audioTrackConfig);
|
||||||
|
// videoTransceiver = pc.AddTransceiver(MediaKind.Video);
|
||||||
|
// videoTransceiver.LocalVideoTrack = localVideoTrack;
|
||||||
|
// videoTransceiver.DesiredDirection = Transceiver.Direction.SendReceive;
|
||||||
|
//
|
||||||
|
// audioTransceiver = pc.AddTransceiver(MediaKind.Audio);
|
||||||
|
// audioTransceiver.LocalAudioTrack = localAudioTrack;
|
||||||
|
// audioTransceiver.DesiredDirection = Transceiver.Direction.SendReceive;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// localAudioTrack?.Dispose();
|
||||||
|
// localVideoTrack?.Dispose();
|
||||||
|
// microphoneSource?.Dispose();
|
||||||
|
// webcamSource?.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -41,6 +41,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
|
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.MixedReality.WebRTC" Version="2.0.2" />
|
||||||
<PackageReference Include="SurrealDb.Net" Version="0.9.0" />
|
<PackageReference Include="SurrealDb.Net" Version="0.9.0" />
|
||||||
<PackageReference Include="WebSocketSharp" Version="1.0.3-rc11" />
|
<PackageReference Include="WebSocketSharp" Version="1.0.3-rc11" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
BIN
mrwebrtc.dll
Normal file
BIN
mrwebrtc.dll
Normal file
Binary file not shown.
Reference in New Issue
Block a user