Ejemplo n.º 1
0
        private void cleanup()
        {
            if (_syncedAudioSource != null)
            {
                _syncedAudioSource.Stop();
            }
            _syncedAudioSource = null;

            UnityEngine.Object.Destroy(texture);
            texture = null;
            VideoTextureManager.deRegisterInstance(_instanceId);
        }
Ejemplo n.º 2
0
        // Constructor. Used to create a video texture and register it with the VideoTextureManager.
        public VideoTexture(string filename, int width, int height, bool shouldLoop = false, float startTime = 0)
        {
            _instanceId = _instanceIdCounter++;

            // Create texture that will be updated in the plugin code
            var texFormat = LiveTextureBinding.isUsingMetalAPI ? TextureFormat.BGRA32 : TextureFormat.ARGB32;

            texture = new Texture2D(width, height, texFormat, false);

            if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                if (LiveTextureBinding.isUsingMetalAPI)
                {
                    _liveTextureStartMetalVideoTexturePlayback(_instanceId, filename, texture.GetNativeTexturePtr(), shouldLoop, startTime);
                }
                else
                {
                    _liveTextureStartVideoTexturePlayback(_instanceId, filename, texture.GetNativeTextureID(), shouldLoop, startTime);
                }
            }

            VideoTextureManager.registerInstance(_instanceId, this);
        }