VideoPlayer Crash on iOS Launch
First off; very new to Unity; coming from an iOS / Swift background:
I have a Unity project with a video player that runs fine on a desktop environment, but when building/running for iOS, I'm getting this StackTrace and a EXC_BAD_ACCESS crash:
-  thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xc38) 
                 - frame #0: 0x000000010126252c ZoolikonDemo`::SetCameraEmitGeometryCallback() [inlined] IsRegistered at CallbackArray.h:223:32 [opt] frame #1: 0x000000010126252c ZoolikonDemo`::SetCameraEmitGeometryCallback() [inlined] IsRegistered at CallbackArray.h:154 [opt] frame #2: 0x000000010126252c ZoolikonDemo`::SetCameraEmitGeometryCallback() [inlined] IsRegistered at CallbackArray.h:291 [opt] frame #3: 0x000000010126252c ZoolikonDemo`::SetCameraEmitGeometryCallback() at VideoPlayer.cpp:1963 [opt] frame #4: 0x0000000101262eb8 ZoolikonDemo`::UpdatePlaybackParams() at VideoPlayer.cpp:2038:5 [opt] frame #5: 0x00000001012649cc ZoolikonDemo`::AwakeFromLoad() at VideoPlayer.cpp:2027:9 [opt] 
 
 
This is the script I have for video playback; which is attached to the Main Camera of my Unity scene:
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class PlayVideoScript : MonoBehaviour {
 public UnityEngine.Video.VideoPlayer videoPlayer;
 bool isOpen = false;
 bool buttonPressed = false;
 void OnGUI() //I think this must be used on the camera so you may have to reference a gui controller on the camera
 {
     if(isOpen) //Is it Open?
     {
         if(GUI.Button(new Rect(Screen.width/2, Screen.height/2, 200, 200), "GREEN")) //Display and use the Yes button
         {
             Debug.Log("Yes");
             videoPlayer.Play();
             isOpen = false;
             buttonPressed = true;
         }
         if(GUI.Button(new Rect(Screen.width/3, Screen.height/2, 200, 200), "RED")) //Display and use the No button
         {
             Debug.Log("No");
             isOpen = false;
             buttonPressed = true;
         }
     }
 }
 // Start is called before the first frame update
 void Start()
 {
     // Will attach a VideoPlayer to the main camera.
     GameObject camera = GameObject.Find("Main Camera");
     // VideoPlayer automatically targets the camera backplane when it is added
     // to a camera object, no need to change videoPlayer.targetCamera.
     videoPlayer = camera.AddComponent<UnityEngine.Video.VideoPlayer>();
     // Play on awake defaults to true. Set it to false to avoid the url set
     // below to auto-start playback since we're in Start().
     videoPlayer.playOnAwake = false;
     // By default, VideoPlayers added to a camera will use the far plane.
     // Let's target the near plane instead.
     videoPlayer.renderMode = UnityEngine.Video.VideoRenderMode.CameraNearPlane;
     // This will cause our Scene to be visible through the video being played.
     videoPlayer.targetCameraAlpha = 0.5F;
     // Set the video to play. URL supports local absolute or relative paths.
     // Here, using absolute.
     videoPlayer.url = "Assets/Zoolikon.mp4";
     // Skip the first 100 frames.
     videoPlayer.frame = 100;
     // Restart from beginning when done.
     videoPlayer.isLooping = false;
     // Each time we reach the end, we slow down the playback by a factor of 10.
     //videoPlayer.loopPointReached += EndReached;
     // Start playback. This means the VideoPlayer may have to prepare (reserve
     // resources, pre-load a few frames, etc.). To better control the delays
     // associated with this preparation one can use videoPlayer.Prepare() along with
     // its prepareCompleted event.
     videoPlayer.Play();
 }
 // Update is called once per frame
 void Update()
 {
     print(videoPlayer.time);
     print(videoPlayer.time);
     if (videoPlayer.time >= 5.0 && buttonPressed == false) {
         print("paused;");
         videoPlayer.Pause();
         isOpen = true;   //Set the buttons to appear
     }
 }
}
,First off, disclaimer; I'm very new to using Unity; coming form an iOS/Swift background...
I have a Unity project with a video player that runs fine on a desktop environment, but when building/running for iOS, I'm getting this StackTrace; and really not sure exactly what seems to be going wrong or where it's happening...
- thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xc38) - frame #0: 0x000000010126252c ZoolikonDemo`::SetCameraEmitGeometryCallback() [inlined] IsRegistered at CallbackArray.h:223:32 [opt] frame #1: 0x000000010126252c ZoolikonDemo`::SetCameraEmitGeometryCallback() [inlined] IsRegistered at CallbackArray.h:154 [opt] frame #2: 0x000000010126252c ZoolikonDemo`::SetCameraEmitGeometryCallback() [inlined] IsRegistered at CallbackArray.h:291 [opt] frame #3: 0x000000010126252c ZoolikonDemo`::SetCameraEmitGeometryCallback() at VideoPlayer.cpp:1963 [opt] frame #4: 0x0000000101262eb8 ZoolikonDemo`::UpdatePlaybackParams() at VideoPlayer.cpp:2038:5 [opt] frame #5: 0x00000001012649cc ZoolikonDemo`::AwakeFromLoad() at VideoPlayer.cpp:2027:9 [opt] 
 
Below is my script for playing a video with a player that's attached to the MainCamera:
public class PlayVideoScript : MonoBehaviour {
 public UnityEngine.Video.VideoPlayer videoPlayer;
 bool isOpen = false;
 bool buttonPressed = false;
 void OnGUI() //I think this must be used on the camera so you may have to reference a gui controller on the camera
 {
     if(isOpen) //Is it Open?
     {
         if(GUI.Button(new Rect(Screen.width/2, Screen.height/2, 200, 200), "GREEN")) //Display and use the Yes button
         {
             Debug.Log("Yes");
             videoPlayer.Play();
             isOpen = false;
             buttonPressed = true;
         }
         if(GUI.Button(new Rect(Screen.width/3, Screen.height/2, 200, 200), "RED")) //Display and use the No button
         {
             Debug.Log("No");
             isOpen = false;
             buttonPressed = true;
         }
     }
 }
 // Start is called before the first frame update
 void Start()
 {
     // Will attach a VideoPlayer to the main camera.
     GameObject camera = GameObject.Find("Main Camera");
     // VideoPlayer automatically targets the camera backplane when it is added
     // to a camera object, no need to change videoPlayer.targetCamera.
     videoPlayer = camera.AddComponent<UnityEngine.Video.VideoPlayer>();
     // Play on awake defaults to true. Set it to false to avoid the url set
     // below to auto-start playback since we're in Start().
     videoPlayer.playOnAwake = false;
     // By default, VideoPlayers added to a camera will use the far plane.
     // Let's target the near plane instead.
     videoPlayer.renderMode = UnityEngine.Video.VideoRenderMode.CameraNearPlane;
     // This will cause our Scene to be visible through the video being played.
     videoPlayer.targetCameraAlpha = 0.5F;
     // Set the video to play. URL supports local absolute or relative paths.
     // Here, using absolute.
     videoPlayer.url = "Assets/Zoolikon.mp4";
     // Skip the first 100 frames.
     videoPlayer.frame = 100;
     // Restart from beginning when done.
     videoPlayer.isLooping = false;
     // Each time we reach the end, we slow down the playback by a factor of 10.
     //videoPlayer.loopPointReached += EndReached;
     // Start playback. This means the VideoPlayer may have to prepare (reserve
     // resources, pre-load a few frames, etc.). To better control the delays
     // associated with this preparation one can use videoPlayer.Prepare() along with
     // its prepareCompleted event.
     videoPlayer.Play();
 }
 // Update is called once per frame
 void Update()
 {
     print(videoPlayer.time);
     print(videoPlayer.time);
     if (videoPlayer.time >= 5.0 && buttonPressed == false) {
         print("paused;");
         videoPlayer.Pause();
         isOpen = true;   //Set the buttons to appear
     }
 }
}
Your answer
 
 
             Follow this Question
Related Questions
'Squashed' Aspect ratio for IOS 360 Video app 0 Answers
Video Player problems on iOS (Unity 2018) 0 Answers
how to send file (local path) using wwwForm on iOS and Android? 1 Answer
How to upload a video to Vimeo from within a Unity application under iOS 3 Answers
Handheld.PlayFullScreenMovie - when I hit maximise in the video controls does not return to game. 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                