private async Task ConnectToRoomAsync()
        {
            var token = await viewModel.GetCallToken(AppSettingsManager.UserNickName);

            client = VideoClient.ClientWithToken(token);

            // Prepare local media which we will share with Room Participants.
            PrepareLocalMedia();

            ConnectOptions connectOptions = ConnectOptions.OptionsWithBlock(builder =>
            {
                builder.LocalMedia = localMedia;
                builder.Name       = "account" + AppSettingsManager.AccountId;
            });

            room = client.ConnectWithOptions(connectOptions, roomDelegate);
        }
Esempio n. 2
0
        private void DoConnect()
        {
            //if (accessToken.token == "") {
            //	LogMessage ("Please provide a valid token to connect to a room");
            //	return;
            //}
            if (!string.IsNullOrEmpty(AppSettingsManager.CallToken))
            {
                accessToken.token = AppSettingsManager.CallToken;
            }
            // Create a Client with the access token that we fetched (or hardcoded).
            if (client == null)
            {
                client = VideoClient.ClientWithToken(accessToken.token);
                if (client == null)
                {
                    LogMessage("Failed to create video client");
                    return;
                }
            }

            // Prepare local media which we will share with Room Participants.
            PrepareLocalMedia();

            ConnectOptions connectOptions = ConnectOptions.OptionsWithBlock(builder => {
                // Use the local media that we prepared earlier.
                builder.LocalMedia = localMedia;
                // The name of the Room where the Client will attempt to connect to. Please note that if you pass an empty
                // Room `name`, the Client will create one for you. You can get the name or sid from any connected Room.
                builder.Name = "Owl";
            });

            // Connect to the Room using the options we provided.
            room = client.ConnectWithOptions(connectOptions, roomDelegate);

            LogMessage($"Attempting to connect to room");
        }