Example #1
0
        private void RegisterPlaybackInterruptedCallback()
        {
            _playbackInterruptedCallback = (code, _) =>
            {
                if (!Enum.IsDefined(typeof(PlaybackInterruptionReason), code))
                {
                    return;
                }

                if (code == PlaybackInterruptionReason.ResourceConflict)
                {
                    OnUnprepared();
                }

                Log.Warn(PlayerLog.Tag, $"interrupted reason : {code}");
                PlaybackInterrupted?.Invoke(this, new PlaybackInterruptedEventArgs(code));
            };

            NativePlayer.SetInterruptedCb(Handle, _playbackInterruptedCallback).
            ThrowIfFailed(this, "Failed to set PlaybackInterrupted");
        }