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 Tutch · Mar 17, 2015 at 09:17 PM · runtimefilemovietexturemovie texture

Loading a movie at runtime and file location

Hey y'all.

I'm doing a project using movie textures, which is mostly done. However, one of the requirements is that the user must be able to have a folder to set his own videos to be loaded by the application.

I already managed to load videos at runtime using WWW class.

 IEnumerator Start () {
         //Debug.Log(Application.dataPath);
         //Debug.Log(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments));
 
         movie = renderer.material.mainTexture as MovieTexture;
         string path = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), "cat.ogv");
 
         // www = new WWW ("file://c://cat.ogv"); <-- works
            www = new WWW("file://c://Program Files (x86)/cat.ogv"); //<-- won't work

 
         while(!www.movie.isReadyToPlay){
             yield return www;
         }
 
         movie = www.movie;
         renderer.material.mainTexture = movie;
     }

Problem is that I tried setting manually a folder on My Documents. It won't work. Then I tried setting a folder on the built project. Won't work.

I've been searching for quite some time (hence the commented Application stuff) but couldn't quite figure out why it won't load the file. I imagine it is a permission thing(?), because it will load files on C: and public users folders, but not anything beyond.

*edited the code to better explain the issue

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 WenM · Sep 07, 2016 at 01:18 PM 0
Share

I also want to achieve the above function to load a video by its path at runtime. Have you got the solution?

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by JigneshKoradiya · Mar 19, 2015 at 10:51 PM

your video must be ".oggtheora" file if you dont have that convert it in it with "MiroConverterSetup"

using UnityEngine;

using System.Collections;

public class movies : MonoBehaviour {

public MovieTexture movTexture;// Use this for initialization

 void Start () 
     {
     renderer.material.mainTexture = movTexture;
     movTexture.Play();
     movTexture.loop = true;
 }
 
 // Update is called once per frame
 void Update () 
     {
 
 }

}

Comment
Add comment · Show 1 · 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 Tutch · Mar 20, 2015 at 01:54 PM 0
Share

$$anonymous$$y video is .oggtheora. The question is not making the video play (it already does), but loading its path somewhere on disk and loading on the script.

avatar image
0

Answer by zzd · Dec 20, 2016 at 08:19 AM

yes ,it is done ,while you check the loaded vedio www object .I get the same problem , and find a method to make it can play ,but that look like very unbelivivable , just Add a MovieTexture Tem value to save the movieTextrue ,like this: MoveTexture mt;

IEumarator xxxx() { www w = new ("xxx"); yield return w; mt = w.movie; yourPlayMaterial.texture = mt; mt.Play();

}

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Using WWW to load all files in StreamingAssets directory 2 Answers

Load external file (.3ds) during runtime 1 Answer

How do I get movie textures to play? 1 Answer

Load data from file, if scene changed, fails to load location 0 Answers

Project building with custom file format 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