예제 #1
0
        public void Init()
        {
            if (_playerNative != null)
            {
                _playerNative.Dispose();
                _playerNative = null;
            }

            switch (Application.platform)
            {
            case RuntimePlatform.Android:
#if UNITY_ANDROID
                _playerNative = new IijkPlayerNativeAndroid(live_url);
#endif
                break;

            case RuntimePlatform.IPhonePlayer:
#if UNITY_IPHONE
                _playerNative = new IijkPlayerNativeIos(live_url);
#endif
                renderObject.transform.rotation = Quaternion.Euler(180, 0, 0);
                break;
            }

            if (_playerNative == null)
            {
                return;
            }

            _playerNative.OnPreparedAction   = OnPreparedAction;
            _playerNative.OnCompletionAction = OnCompletionAction;

            SetPlayerOptions();
            renderObject.texture = _playerNative.UnityExternalTexture;
        }
예제 #2
0
        public void ReleasePlayer()
        {
            OnDisconnect = null;
            OnPrepared   = null;

            _playerNative?.Dispose();
            _playerNative = null;
        }