Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 eightbitstev · Mar 18, 2014 at 07:57 PM · androidioswwwvideohandheld

Handheld.PlayFullScreenMovie() works on Android but not iOS?

I'm trying to download a movie from the web and then play it on my phone using the native video player. I'm working with an LG Nexus 5 and an iPad 3. I've got Unity Pro, Android Pro, and iOS Pro. I can get the builds up and running just fine, and when I point Handheld.PlayFullScreenMovie() to an mp4 on the internet, it works fine on both devices. The problem I'm having is getting a downloaded movie file to play on the iPad. Using the code below, the movie will download just fine and play on my Nexus 5, but it won't play the movie using the iPad, even thought it seems to download just fine on the iPad. Any thoughts?

Here's what I've got... (this same script is set on two different buttons in the scene, one is a download button, one is a play button.)

 string filepath;
 
 void OnMouseDown () {
         if (buttontype == ButtonType.Download)
             StartCoroutine(BeginDownload());
         if (buttontype == ButtonType.Play)
             Play ();
     }
 
 void Play(){
         Handheld.PlayFullScreenMovie("file://"+filepath);
     }
 
 
 IEnumerator BeginDownload(){
         filepath = Application.persistentDataPath + "/test.mp4";
         WWW www = new WWW("http://www.example.com/test.mp4");
         while (!www.isDone){
             yield return null;
         }
         Debug.Log("DONE!");
         System.IO.File.WriteAllBytes(filepath,www.bytes);
     }

I'm thinking the problem might lay somewhere in the directory path and how iOS stores the data.

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 eightbitstev · Mar 18, 2014 at 11:45 PM 0
Share

Finally figured this out. I made a simple programmer 101 mistake! I recently split this up onto two different buttons, so obviously the string filepath is only set on one button and not the other. During my android tests I had set the default value of filepath to the actual path that android was looking for, so it all worked fine for my android tests. I just set my filepath variable to static and everything works fine now. BAAAAHHHHHHHHHH I can't believe that took me so long!!!

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Bovine · Mar 18, 2014 at 08:28 PM

On iOS your video must live in a folder in the root of your project called StreamingAssets otherwise it cannot be found. I don't know what the deal is on Android.

See here:

http://docs.unity3d.com/Documentation/Manual/StreamingAssets.html

In fact, that doc link should tell you all you need to know.

I believe full screen video is a Pro feature for iOS at least, not sure about on Android.

Comment
Add comment · Show 6 · 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 eightbitstev · Mar 18, 2014 at 08:41 PM 0
Share

$$anonymous$$aybe my understanding is incorrect on this, but I was under the impression that the Strea$$anonymous$$gAssets folder was something that you set up in your Unity project in advance? I'm looking to download a movie from the web and then play it as a fullscreen video.

avatar image eightbitstev · Mar 18, 2014 at 08:53 PM 0
Share

I'm going to try using Application.strea$$anonymous$$gAssetsPath. I can't imagine why Unity would label something as "strea$$anonymous$$g assets" and then intend it to not be streamed. That doesn't make sense.

edit: It doesn't fix the problem. Still works on Android, still doesn't work on iOS.

avatar image Bovine · Mar 18, 2014 at 09:49 PM 0
Share

Sorry, yes I see you're downloading it. The path is indeed setup ahead time in the assets folder and I guess it is called strea$$anonymous$$g because the asset is streamed from storage rather than loaded into memory.

avatar image eightbitstev · Mar 18, 2014 at 09:58 PM 0
Share

Ah! That makes sense.

avatar image Bovine · Mar 18, 2014 at 11:13 PM 0
Share

Hmmm seems there used to be a iPhoneUtils.Play$$anonymous$$ovieURL() method that is now deprecated and I don't see a replacement, though it may be there is an asset that will do this?

Show more comments
avatar image
0

Answer by ksiUnity · Nov 06, 2015 at 02:26 PM

I have used this funtion on both platforms and it works for me. Just Handheld.PlayFullScreenMovie("file://"+filepath); would be enough. Try using loadfromcacheordownload instead of just www

Comment
Add comment · 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

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

23 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

Related Questions

FullScreenMovieScalingMode.AspectFit not working on iOS and Android 0 Answers

Play video to chromecast 1 Answer

Unity Video ads closing when player leaves app. 0 Answers

RawImage with correct aspect ratio 2 Answers

Video playback in Android doesn't change orientation 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