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 /
avatar image
0
Question by psykojello2 · Oct 20, 2015 at 11:53 AM · unity5videovideotexturevideo streaming

Playing Video in Unity 5 (on mobile)

I'm using Unity 5 free and wondering if there's a way to play back a movie (I'm using it for the intro movie the first time you play the game).

I'm fine with either loading the video directly or streaming it from the web if that's the only possible way.

All the answers I find mention Unity Pro, but they're also pre-Unity5, so I'm not sure if its changed since then.

When I try to bring a video file into Unity, it does not give me import options. I'm not able to assign it to a MovieTexture. I have Quicktime installed on Windows.

How does everyone else do it? Is there a plugin or an asset that would help me?

Comment
Add comment · Show 2
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 psykojello2 · Nov 12, 2015 at 10:51 PM 0
Share

Anyone? :(

avatar image ilanpenn · Apr 04, 2017 at 05:14 AM 0
Share

Once I build the app I'm just receiving an empty game screen that is continually flashing. I didn't have any errors pushing the build.

Any clue why?

4 Replies

· Add your reply
  • Sort: 
avatar image
4
Best Answer

Answer by psykojello2 · Nov 13, 2015 at 01:57 PM

Answering my own question...

I can't believe I didn't find this while searching the forums, but as of Unity 5, you can use Handheld.PlayFullScreenMovie() to play a video file in StreamingAssets. http://docs.unity3d.com/ScriptReference/Handheld.PlayFullScreenMovie.html

Read the info on file formats in there. I used VLC Player to export my movie to H.264 mp4 file.

I then Imported the file into an arbitrary folder under Assets in Unity (Not the streaming assets folder). Unity should recognize this file as a movie and give you some options in the inspector.

NOW, move the file into StreamingAssets. If you do it directly, it doesn't recognize it as a movie for some reason. *shrug.

I hope this helps someone!

Comment
Add comment · Show 2 · Share
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 biggsthecat · Jul 27, 2016 at 06:23 PM 0
Share

Works brilliantly, cheers for the fix. If you put the Handheld player call inside an IEnumerator function and do a

yield return new WaitForEndOfFrame();

then you can set up a different function to start when the video is finished or cancelled.

avatar image imLowe · Nov 27, 2017 at 01:58 PM 0
Share

I cant see the video in my unity editor, the vid only show up when I install the build in my mobile?

avatar image
2

Answer by guruDeRareKing006 · Mar 04, 2017 at 09:11 AM

Hi all Guru here , i was searching for the same but after a pro long struggle i have made it work..

I just wanted people to know about the complete process here itself..

Question : How to playback a video in android platform using unity c-sharp ?

Answer :

Step 1< --- Make sure about the formats and the settings of the video , mp4 h.264 (640x480) worked for me.

Step 2< --- Create a folder inside your Assets folder and name it as "StreamingAssets" (without space , it is case sensitive). Place your video in the folder.

Step 3< --- Write a new c-sharp script using the code below :

"using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement;"

public class playbackVideoHandHeld : MonoBehaviour {

 private string movie = "yourVideoNameHere.mp4";
 public int sceneNumber;

 // Use this for initialization
 void Start () 
 {
     StartCoroutine(streamVideo(movie));
 }

 private IEnumerator streamVideo(string video)
 {
     Handheld.PlayFullScreenMovie(video, Color.black, FullScreenMovieControlMode.Full, FullScreenMovieScalingMode.AspectFill);
     yield return new WaitForEndOfFrame();
     Debug.Log("The Video playback is now completed.");
     SceneManager.LoadScene (sceneNumber);
 }

}

Step 4< --- Create an empty GameObject and attach the script to it.

Note : You will not see the video playing in the editor or by using build and run , you have to build the app and install in order to check it.

Step 5< --- The step four's note session is the most important part where i have spent a loads of time.

Note : If unity throws error while building it to an apk which says like something went wrong in the AndroidManifest.xml or some winsdk error just change the Minimum API Level under Other Settings of the Player Settings and see which one works for you.

Thanks, Guru

Comment
Add comment · Show 2 · Share
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 sutapa · Mar 14, 2017 at 09:36 AM 0
Share

HI Guru , This works . great !!!

Can you please let me know if I want to know play the same in VR mode what changes shall i do. As the video is playing on start , not entering the vr mode although i hv attached the vr settings.

Thanks , Sutapa

avatar image wushuwushu000 · Sep 23, 2017 at 01:26 PM 0
Share

Hi Guru! i just want to ask why does my video is looping from the start even though it hasn't finish playing. The start of the video is looping. I use the same process as you mention above. thanks!

avatar image
0

Answer by brunopava · Nov 13, 2015 at 01:57 PM

There is two plugins that can do that on mobile. Mobile Movie Texture and Easy Movie Texture.

https://www.assetstore.unity3d.com/en/#!/content/10032

https://www.assetstore.unity3d.com/en/#!/content/2449

Comment
Add comment · Show 2 · Share
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 psykojello2 · Nov 14, 2015 at 12:49 AM 0
Share

thanks @brunopava!

However I can confirm that the built in Handheld.PlatFullScreen$$anonymous$$ovie() works on iOS and Android with Unity 5 (Free).

avatar image csansonetti · Sep 14, 2016 at 12:33 PM 0
Share

Hi Bruno, do you know if the Easy $$anonymous$$ovie Texture plugin works on the FREE version of Unity 5.x? Thanks!

avatar image
0

Answer by brunopava · Nov 13, 2015 at 12:32 PM

https://www.assetstore.unity3d.com/en/#!/content/2449

https://www.assetstore.unity3d.com/en/#!/content/10032

These two work fine. I have tested them.

Comment
Add comment · Show 2 · Share
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 jhuynh_isobar · Feb 11, 2017 at 03:25 PM 0
Share

$$anonymous$$obile $$anonymous$$ovie Texture isn't on the store any longer.

I recently purchased Easy $$anonymous$$ovie Texture and it works in the Unity Editor, but I get this error when I build to Android: alt text I'm using Unity 5.5.0f3, and build for Android 4.4 $$anonymous$$it $$anonymous$$at, and Android 6 $$anonymous$$arshmallow. It seems like a pretty straight forward set-up, but I'm not sure why it's not working.

error-screenshot-2017-02-10-12-47-13.png (24.0 kB)
avatar image tanoshimi jhuynh_isobar · Feb 11, 2017 at 03:27 PM 0
Share

There is no need for any plugins. PlayFullScreen$$anonymous$$ovie is built into Unity - https://docs.unity3d.com/ScriptReference/Handheld.PlayFullScreen$$anonymous$$ovie.html

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

42 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

Related Questions

How to Cycle video through sphere as a texture ? 0 Answers

How to play video on WEBGL 0 Answers

Using VideoPlayer to stream a video from a website 3 Answers

Is there any way to receive RTSP/RTP video stream on Windows Store build? 0 Answers

MovieTexture.duration is giving me the wrong time. 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