For our application design we are supposed to play an introduction movie when the application first starts. This video is normally some animated logo or similar and in our case it will be the Sojourner Mobile intro movie (sometimes referred to as an interstitial).
I'm going to assume that you aren't a video engineer and don't know a lot about MPEG-4, H.264, or B Frames, but you have some content that you want to get into your iOS project. This is one thing that gives a lot of new developers trouble and results in video not displaying on the device.
We can avoid all of this drama by simply using a tool that was designed for producing content for iOS devices. One such tool that you can use for this is iMovie. It has functionality for exporting iOS device compliant video that you can use with your projects.
Note that you can choose the Medium size as well, but since this is media that is being embedded into our game, and will count against our maximum application size, it is best to keep this content as small as possible so that you can keep it for other things such as game assets.
StreamingAssets
. Unity will copy the files in this directory into our application bundle and put them in the appropriate location on the device so we can play them back at runtime:Now that we have our asset in the game we need to play it. The best way to do this is to have a single scene that does nothing other than display our movie and then loads the IntroCity scene.
Start()
of the script. We need to use the C# co-routine version of the Start()
method as opposed to our normal version.using UnityEngine; using System.Collections; public class PlayIntroMovie : MonoBehaviour { // Use this for initialization IEnumerator Start () { iPhoneUtils.PlayMovie("Snowpocalypse2011.m4v", Color.black, iPhoneMovieControlMode.CancelOnTouch, iPhoneMovieScalingMode.AspectFill ); yield return null; Application.LoadLevel("IntroCity"); } }
18.117.74.44