Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by narner · Jan 28, 2020 at 09:28 AM · iosvideo

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
     }

 }

}

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

227 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges