private void CallbackReadyPlayer(string message) { videoDuration = AVPlayerConnect.AVPlayerGetDuration(avPlayer); // Texture settings IntPtr texPtr = AVPlayerConnect.AVPlayerGetTexturePtr(avPlayer); Texture2D texture = Texture2D.CreateExternalTexture( 512, 512, TextureFormat.BGRA32, false, false, texPtr); texture.UpdateExternalTexture(texPtr); videoSizeWidth = AVPlayerConnect.AVPlayerGetVideoWidth(avPlayer); videoSizeHeight = AVPlayerConnect.AVPlayerGetVideoHeight(avPlayer); if (videoImage != null) { videoImage.texture = texture; Vector2 scale = new Vector2(1f, -1f); videoImage.material.SetTextureScale("_MainTex", scale); } StartCoroutine(OnRender()); // Seek settings if (seekSlider != null) { seekSlider.interactable = true; seekSlider.maxValue = videoDuration; seekSlider.minValue = 0f; seekSlider.value = 0f; SliderEventTrigger trigger = seekSlider.GetComponentInChildren <SliderEventTrigger>(); if (trigger != null) { trigger.BeginAction = SeekSliderInitializePointerDrag; trigger.MovingAction = SeekSliderDrag; trigger.EndAction = SeekSliderPointerUp; } } StartCoroutine(OnUpdateText()); StartCoroutine(OnUpdateSeekSlider()); // Callback settings AVPlayerConnect.AVPlayerSetOnEndTime( avPlayer, transform.root.gameObject.name, ((Action <string>)CallbackEndTime).Method.Name); AVPlayerConnect.AVPlayerSetOnSeek( avPlayer, transform.root.gameObject.name, ((Action <string>)CallbackSeek).Method.Name); VideoSizeEvent videoSizeEvent = new VideoSizeEvent(); videoSizeEvent.SetCallback(avPlayer, (sender, width, height) => { StartCoroutine(OnUpdateVideoSize(width, height)); }); // UI settings if (prepareButton != null) { prepareButton.interactable = false; } if (playButton != null) { playButton.interactable = true; } }