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 Nikixiaoyou · Nov 23, 2015 at 08:19 PM · wwwmovietexturestreamingassets

Problem playing movietexture only with local file

Hi!

It's my first time on this forum so please excuse any mistake I could do regarding forum rules.

I have Unity Pro and am trying to play a movie from the Streaming Assets folder (standalone build). I can successfully play the movie with the WWW class, as long as it uses an url from the web. The movie is in ogg format. That same movie, when inside the Streaming Assets folder, fails to play. Trying a few things I found out it's actually never ready to play.

Here's the code:

 IEnumerator StartVideo ()
     {   
         WWW www = new WWW(System.IO.Path.Combine(Application.streamingAssetsPath, "sample.ogg"));
         while (!www.isDone)
             yield return null;
             
         MovieTexture movieTexture = www.movie;
             
         GetComponent<RawImage>().texture = movieTexture;
         MovieTexture movieToPlay = GetComponent<RawImage>().texture as MovieTexture;
         
         movieToPlay.Play();
     }

Any idea why it works on the web and not in the Streaming Assets folder? I can see that it was imported successfully in Unity, so that's not the issue.

Thank you very much!

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by saschandroid · Nov 24, 2015 at 08:12 AM

 WWW www = new WWW("file:///" + System.IO.Path.Combine(Application.streamingAssetsPath, "sample.ogg"));
Comment
Add comment · Show 3 · 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 Nikixiaoyou · Nov 25, 2015 at 02:47 PM 0
Share

Thank you for your answer @saschandroid. Unfortunately, that didn't do the trick (I had already tried something similar with only two forward slashes ins$$anonymous$$d of three, and it didn't work also).

There might be something wrong with our Unity, or with this version in particular (version 5.2.2f1)...

avatar image saschandroid Nikixiaoyou · Nov 27, 2015 at 10:06 AM 0
Share

This works for me:

 $$anonymous$$ovieTexture movieTexture;
 IEnumerator StartVideo()
 {
     WWW www = new WWW("file:///" + System.IO.Path.Combine(Application.strea$$anonymous$$gAssetsPath, "movie.ogg"));
     Debug.Log("www: " + www.url);
     yield return www;
     movieTexture = www.movie;
     Debug.Log("$$anonymous$$ovie is ready to play: " + movieTexture.isReadyToPlay);
 }


avatar image saschandroid Nikixiaoyou · Nov 27, 2015 at 11:14 AM 0
Share

$$anonymous$$mh, this works for me (movie is ready to play):

  $$anonymous$$ovieTexture movieTexture;
     IEnumerator StartVideo()
     {
         WWW www = new WWW("file:///" + System.IO.Path.Combine(Application.strea$$anonymous$$gAssetsPath, "movie.ogg"));
         yield return www;
         movieTexture = www.movie;
         Debug.Log("$$anonymous$$ovie: " + movieTexture.isReadyToPlay);
     }

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How can I load a mp4 from a website to use as a Movie Texture at runtime? 0 Answers

MovieTexture .ogg file size limit? 0 Answers

[help]How can I read the file in StreamingAssets on iPad/iPhone platform??? 0 Answers

'movie' is not a member of 'UnityEngine.WWW' 1 Answer

StreamingAssets - reading from file on android 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