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
1
Question by Zeno · Nov 28, 2011 at 10:19 PM · editorcoroutinewwwmovietexturestreaming

WWW in Editor getting request with null attributes

I'm trying to write an editor-only script that will take a link to a streaming OGG video, download it, get the height/width and video name, then use that to build a screen and RenderTexture of the same size as the video.

I've gotten every part of it seemingly working, it spends about 10-15 seconds downloading a movie, but if I check the returned movie, it's name is null and it's size is 16 by 16. I've checked the video streams I've been using for this, and they work fine, so it must be something with the code.

Here is the actual download IEnumerator (C#), it takes the actual address from a function elsewhere in the class (the URL comes through fine).

     IEnumerator DownloadVideo(string videoURL)
     {
         Debug.Log("Loading " + videoURL + " ...");
         request = new WWW(videoURL);
         while (!request.isDone)
         {
             EditorUtility.DisplayProgressBar("Downloading video " + (currentNum + 1), "Downloading " + request.progress.ToString("#0%") + "...", request.progress);
             yield return null;
         }
         EditorUtility.ClearProgressBar();

         if (request.error != null)
         {
             Debug.LogError(request.error);
             yield break;
         }
         
         Debug.Log("Adding downloaded movie by name of \"" + request.movie.name + "\", with a file size of = " + request.size + ", and a Height:Width of = " + request.movie.height + ":" + request.movie.width);
         GameObject screen = CreateScreen(request.movie, currentNum * 2);
         Debug.Log("curretNum = " + currentNum);
         SetupScreen(screen, streamingVideos[currentNum]);

         currentNum += 1;
         if (currentNum < streamingVideos.Count)
         {
             currentURL = streamingVideos[currentNum];
             en = null;
         }
         else
             run = false;
     }

The long Debug Log will return: "Adding downloaded movie by name of "", with a file size of = 2864977, and a Height:Width of = 16:16" So it's getting an actual file with a size, and it takes about 10-15 seconds to download the movie usually, but the name shouldn't be "" nor should the height be 16:16, trying with another stream gets the same results (though a different file size).

I use a sort of manual Coroutine in the update to work the downloading with a GUI button setting run = true;

     void Update()
     {
         if (!run)
         {
             if (en != null)
                 en = null;
             return;
         }
         else
         {
             if (en == null && !string.IsNullOrEmpty(currentURL))
             {
                 en = DownloadVideo(currentURL);
             }
             if (!en.MoveNext())
                 run = false;
         }
     }

Are there any obvious problems that stick out here or any ideas on what might be causing the null values to come through? I'm really stumped by this.

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
Best Answer

Answer by Zeno · Nov 30, 2011 at 11:12 PM

Turns out all I had to do was assign it to a MovieTexture variable then do movie.Play() and it worked.

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

2 People are following this question.

avatar image avatar image

Related Questions

Splash videos on android and iOS? 0 Answers

WWW.movie never get ready to play ? 0 Answers

Problem playing audio for streaming video 0 Answers

Black MovieTexture with Audio streaming on Mac? -1 Answers

Yielding with WWW in Editor 9 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