I want to play a video inside a project that works on Magic Leap 2 using MRTK Sdk 2 , but when I use a video player component with texture render, it works on the editor, but it crashes on the screen, and when using the "MLMediaPlayerBehavior" method, the video does not work on the editor, and it also does not work on the screen.
Please help me to solve this problem
Magic Leap 2 does not currently support the standard Unity Video player. To see how to ouse the MLMediaPlayerBehavior, see the Unity Examples Project.
Unfortunately, the Magic Leap Media player is not currently supported inside the Editor or on Standalone.
You can use both components with conditional compilation flags in order to test a video in editor and on device. Unfortunately you may need to write some code twice for UI to work with both players.
private MLMediaPlayerBehavior mediaPlayerBehavior;
private VideoPlayer vp;
private void Start()
{
mediaPlayerBehavior = GetComponent<MLMediaPlayerBehavior>();
vp = GetComponent<VideoPlayer>();
#if UNITY_EDITOR
mediaPlayerBehavior.enabled = false;
vp.enabled = true;
#elif UNITY_ANDROID
mediaPlayerBehavior.enabled = true;
vp.enabled = false;
#endif
}
public void OnPlayButton()
{
#if UNITY_EDITOR
vp.Play();
#elif UNITY_ANDROID
mediaPlayerBehavior.Play();
#endif
}