void Start() { try { // Creation of the NexPlayer instance player = NexPlayerFactory.GetNexPlayer(); // Register to the events of NexPlayer player.OnEvent += EventNotify; // Initialize NexPlayer with an URI player.Init(URL, autoPlay, extendedLogs); // Change the text informing the status of the player status.text = "Opening..."; // The coroutine needs to be started after the player is created an initialized StartCoroutine(player.CoroutineEndOfTheFrame()); } catch (System.Exception e) { Debug.LogError("Error while initializing the player. Please check that your platform is supported."); Debug.LogError("Exception: " + e); status.text = "Error"; player = null; } }
void OnDisable() { if (player != null) { StopCoroutine(player.CoroutineEndOfTheFrame()); player = null; } }