Пример #1
0
        // ================================================
        // EXPOSED API
        // ================================================

        /// <summary>
        /// Loads the video at the given path (or URL)
        /// </summary>
        /// <param name="path"></param>
        public void Load(string path)
        {
            m_NativeCallback = new Plugin.StateChangedCallback(HandleStateChange);

            if (Plugin.CreateMediaPlayback(m_NativeCallback) != 0)
            {
                LogError("Could not create media playback");
            }

            if (Plugin.LoadContent(path) != 0)
            {
                LogError("Could not load path");
            }
        }
Пример #2
0
        // my OnEnable

        public void CustomOnEnable()
        {
            // create callback
            this.stateCallback = new Plugin.StateChangedCallback(MediaPlayback_Changed);

            // create media playback
            CheckHR(Plugin.CreateMediaPlayback(this.stateCallback));

            // create native texture for playback
            IntPtr nativeTexture = IntPtr.Zero;

            CheckHR(Plugin.CreatePlaybackTexture((uint)Screen.currentResolution.width, (uint)Screen.currentResolution.height, out nativeTexture));

            // create the unity texture2d
            this.playbackTexture = Texture2D.CreateExternalTexture((int)Screen.currentResolution.width, (int)Screen.currentResolution.height, TextureFormat.BGRA32, false, false, nativeTexture);

            // set texture for the shader
            GetComponent <Renderer>().material.mainTexture = this.playbackTexture;
        }