• 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 /
avatar image
0
Question by liszto · May 20, 2012 at 08:20 AM · androidmobileimportvideo

video & mobile

hi everybody, I wanted to know how to read a little intro video in a mobile application?

For now, I have this code that there is supposed to work on phones but when we tested, it does not work :/

 using UnityEngine;
 using System.Collections;
 
 [RequireComponent (typeof (GUITexture))]
 [RequireComponent (typeof (AudioSource))]
 
 public class SplashScriptScreen : MonoBehaviour
 {
    public float m_timer = 12.0f;
    
     public string m_loadLevel = "MainMenu";
    
    //the GUI texture
    private GUITexture videoGUItex;
 #if UNITY_STANDALONE_WIN   
    //the Movie texture
    private MovieTexture mTex;
 #endif   
    //the AudioSource
    private AudioSource movieAS;
    
    //the movie name inside the resources folder
    public string movieName;
    
     void Awake()
    {
       //get the attached GUITexture
       videoGUItex = this.GetComponent<GUITexture>();
       
       //get the attached AudioSource
       movieAS = this.GetComponent<AudioSource>();
 #if UNITY_STANDALONE_WIN      
       //load the movie texture from the resources folder
       mTex = (MovieTexture)Resources.Load("Video/"+movieName);
          
       //set the AudioSource clip to be the same as the movie texture audio clip
       movieAS.clip = mTex.audioClip;
    
       //letterbox
       float newHeight = -(Screen.height-(Screen.width/(mTex.width/(float)mTex.height)));
       float yOffset = (-Screen.height-newHeight)/2;
       videoGUItex.pixelInset = new Rect(Screen.width/2, yOffset, 0, newHeight);
 #endif   
    }
 
    //On Script Start
    void Start()
    {
       StartCoroutine("SplashDisplay"); 
    }
    
    IEnumerator SplashDisplay()
     {
 #if UNITY_ANDROID
       iPhoneUtils.PlayMovie("Intro.mp4", Color.black);
 #else
       //set the videoGUItex.texture to be the same as mTex
       videoGUItex.texture = mTex;
       
       //Plays the movie
       mTex.Play();
       
       //plays the audio from the movie
       movieAS.Play(); 
 #endif
       yield return new WaitForSeconds(m_timer);
         
       Application.LoadLevel(m_loadLevel);
       
     }
 }

mp4 format give me some problems at the moment of the importation in Unity (Quicktime problems). So I convert my video in ogv then I import it in Unity and this works. But, this format is not suppoted on mobile. mp4 and 3gpp only on Android.

If someone already import and use a video on a mobile application, I'm willing him to explain how.

Comment
Add comment · Show 1
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
avatar image liszto · May 20, 2012 at 08:22 AM 0
Share

And we follow the instructions on $$anonymous$$obile page but create a folder named Strea$$anonymous$$gAssets doesn't solve the problem (except if we do this wrong)

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Record a video in unity on mobile (Android, IOS) 1 Answer

StreamingAssets on Android. 1 Answer

Video to be play in a 360 degree fashion? 2 Answers

Kindle Fire Video Streaming Crash 0 Answers

Knowing the position 1 Answer


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