예제 #1
0
        public async Task StartSessionAsync()
        {
            var sessionId = OpentokTestConstants.GenerateSessionAndTokenWithServer ? await OpentokSessionHelper.RequestDataFromApiAsync(OpentokSessionHelper.SessionRequestURI, OpentokSettings.Current.RoomName) : OpentokTestConstants.SessionId;

            var token = OpentokTestConstants.GenerateSessionAndTokenWithServer ? await OpentokSessionHelper.RequestDataFromApiAsync(OpentokSessionHelper.TokenRequestURI, sessionId) : OpentokTestConstants.Token;

            BusyIndicatorView.Hidden = BusyViewLayer.Hidden = BusyTextView.Hidden = true;
            ContainerView.Hidden     = LocalView.Hidden = false;
            _opentokService.SetStreamContainer(ContainerView, false);
            _opentokService.SetStreamContainer(LocalView, true);
            _opentokService.InitNewSession(OpentokTestConstants.OpentokAPIKey, sessionId, token);
            UIApplication.SharedApplication.IdleTimerDisabled = true;
        }
예제 #2
0
        public async Task StartSessionAsync()
        {
            var sessionId = OpentokTestConstants.GenerateSessionAndTokenWithServer ? await OpentokSessionHelper.RequestDataFromApiAsync(OpentokSessionHelper.SessionRequestURI, OpentokSettings.Current.RoomName) : OpentokTestConstants.SessionId;

            var token = OpentokTestConstants.GenerateSessionAndTokenWithServer ? await OpentokSessionHelper.RequestDataFromApiAsync(OpentokSessionHelper.TokenRequestURI, sessionId) : OpentokTestConstants.Token;

            FindViewById <RelativeLayout>(Resource.Id.loading_layer).Visibility  = ViewStates.Gone;
            FindViewById <ProgressBar>(Resource.Id.loading_indicator).Visibility = ViewStates.Gone;
            _opentokService.SetStreamContainer(FindViewById <FrameLayout>(Resource.Id.local_video_view_container), true);
            _opentokService.SetStreamContainer(FindViewById <FrameLayout>(Resource.Id.remote_video_view_container), false);
            _opentokService.InitNewSession(OpentokTestConstants.OpentokAPIKey, sessionId, token);
            this.Window.AddFlags(WindowManagerFlags.KeepScreenOn);
            var self = this;

            _opentokService.OnSessionEnded += () =>
            {
                Finish();
                self.Window.ClearFlags(WindowManagerFlags.KeepScreenOn);
            };
            _opentokService.OnPublishStarted += () =>
            {
                FindViewById(Resource.Id.local_video_container).Visibility      = _isVideoEnabled ? ViewStates.Visible : ViewStates.Gone;
                FindViewById(Resource.Id.local_video_view_container).Visibility = _isVideoEnabled ? ViewStates.Visible : ViewStates.Gone;
                FindViewById(Resource.Id.local_video_overlay).Visibility        = _isVideoEnabled && !_opentokService.IsAudioPublishingEnabled ? ViewStates.Visible : ViewStates.Gone;
            };
        }