示例#1
0
        internal void PlayHandler(CallEventParams.PlayParams playParams)
        {
            OnPlayStateChange?.Invoke(mAPI, this, playParams);

            switch (playParams.State)
            {
            case CallEventParams.PlayParams.PlayState.playing:
                OnPlayPlaying?.Invoke(mAPI, this, playParams);
                break;

            case CallEventParams.PlayParams.PlayState.error:
                OnPlayError?.Invoke(mAPI, this, playParams);
                break;

            case CallEventParams.PlayParams.PlayState.paused:
                OnPlayPaused?.Invoke(mAPI, this, playParams);
                break;

            case CallEventParams.PlayParams.PlayState.finished:
                OnPlayFinished?.Invoke(mAPI, this, playParams);
                break;

            default: break;
            }
        }
        private void Call_OnPlayStateChange(CallingAPI api, Call call, CallEventParams.PlayParams playParams)
        {
            switch (playParams.State)
            {
            case CallEventParams.PlayParams.PlayState.error:
            case CallEventParams.PlayParams.PlayState.finished:
                Call.OnPlayStateChange -= Call_OnPlayStateChange;
                mFinished.SetResult(true);
                break;

            default: break;
            }
        }