Beispiel #1
0
        protected override async void OnNavigatedTo(NavigationEventArgs args)
        {
            var signaller = new WebsocketSignaller();

            this.ConnectToServerButton.Click += async(s, a) =>
            {
                this.NotConnected.Hide();
                await signaller.ConnectToServer(ServerConfig.AwsAddress);

                this.Connected.Show();
            };

            this.DisconnectFromServerButton.Click += (s, a) =>
            {
                this.Connected.Hide();
                signaller.DisconnectFromServer();
                this.NotConnected.Show();
            };

            var config = new ConductorConfig()
            {
                CoreDispatcher = this.Dispatcher,
                Signaller      = signaller
            };

            Logger.Log("Initializing WebRTC...");
            await this.conductor.Initialize(config);

            Logger.Log("Done.");

            var opts = new MediaOptions(
                new MediaOptions.Init()
            {
                SendVideo = true
            });

            this.conductor.SetMediaOptions(opts);

            this.conductor.UISignaller.ReceivedShutdown += async(s, a) =>
            {
                await this.conductor.Shutdown();
            };

            this.conductor.UISignaller.ReceivedPlain += (s, message) =>
            {
                Logger.Log(message);
            };

            var devices = await this.conductor.GetVideoDevices();

            this.MediaDeviceComboBox.ItemsSource   = devices;
            this.MediaDeviceComboBox.SelectedIndex = 0;

            this.CaptureFormatComboBox.ItemsSource =
                await this.conductor.GetCaptureProfiles(devices.First());

            this.CaptureFormatComboBox.SelectedIndex = 0;
        }
Beispiel #2
0
        protected override async void OnNavigatedTo(NavigationEventArgs args)
        {
            signaller = new WebsocketSignaller();

            this.SetUpCallButton.Click += async(s, a) =>
            {
                this.NotConnected.Hide();
                await signaller.ConnectToServer("ws://drhololens-env.esncizasfm.us-east-2.elasticbeanstalk.com/");

                this.Connected.Show();
            };

            this.HangUpCallButton.Click += (s, a) =>
            {
                this.Connected.Hide();
                this.conductor.Shutdown();
                this.NotConnected.Show();
            };

            this.DisconnectFromServerButton.Click += (s, a) =>
            {
                Logger.Log("Disconnected from server");
                signaller.DisconnectFromServer();
            };

            var config = new ConductorConfig()
            {
                CoreDispatcher = this.Dispatcher,
                RemoteVideo    = this.RemoteVideo,
                Signaller      = signaller
            };

            Logger.Log("Initializing WebRTC...");
            await this.conductor.Initialize(config);

            Logger.Log("Done.");

            var opts = new MediaOptions(
                new MediaOptions.Init()
            {
                SendAudio    = true,
                ReceiveAudio = true
            });

            this.conductor.SetMediaOptions(opts);

            this.conductor.UISignaller.ReceivedShutdown += async(s, a) =>
            {
                await this.conductor.Shutdown();
            };

            this.conductor.UISignaller.ReceivedPlain += (s, message) =>
            {
                Logger.Log(message);
            };
        }