• 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 supachailllpay · Apr 20, 2017 at 09:20 AM · webglassetbundlevideostreamingassets

Problem with AssetBundles and StreamingAssets in Android an WebGL

Hi I everyone, I follow this guideline to use AssetBundles and StreamingAssets. It work fine in StandaloneOSXUniversal but not in Android and WebGL.


In Android, Texture file load normally but Video has this error

 04-19 16:44:16.700 22433 22459 W Unity   : AndroidVideoMedia: Error opening extractor: -10000
 04-19 16:44:16.700 22433 22459 W Unity   :  
 04-19 16:44:16.700 22433 22459 W Unity   : (Filename:  Line: 427)
 04-19 16:44:16.700 22433 22459 W Unity   : 

In WebGL not working both Texture file and Video

 blob:http://localhost:54474/4387db25-76d0-4ba1-8949-b82fc597be9e:2 Unable to open archive file: http://localhost:54474/StreamingAssets/video
  
 (Filename:  Line: 483)


I'm using unity 5.6.0f3 on macOS Sierra and this is my code.


Create Bundle (Of course I change target to WebGL when build with WebGL)

 [MenuItem ("Assets/Build Android Bundle")]
 static void BuildAllAssetBundles () {
     BuildPipeline.BuildAssetBundles ("Assets/StreamingAssets", BuildAssetBundleOptions.UncompressedAssetBundle, BuildTarget.Android);
 }

Use it

 void Start () {
     AssetBundle bundle = AssetBundle.LoadFromFile (Path.Combine (Application.streamingAssetsPath, "video"));
     player.clip = bundle.LoadAsset<VideoClip> ("Hall.mov");
     plane.material.SetTexture ("_MainTex", bundle.LoadAsset<Texture> ("Image.jpg"));
 }

After trying a lot of things, I'm not sure LoadFromFile method can use with WebGL so I try

 IEnumerator Start () {
     #if UNITY_WEBGL
     WWW www = WWW.LoadFromCacheOrDownload ("http://localhost:8080/StreamingAssets/video", 5);
     yield return www;
     AssetBundle bundle = www.assetBundle;
     #else
         AssetBundle bundle = AssetBundle.LoadFromFile (Path.Combine (Application.streamingAssetsPath, "video"));
     #endif
 
     player.clip = bundle.LoadAsset<VideoClip> ("Hall.mov");
     plane.material.SetTexture ("_MainTex", bundle.LoadAsset<Texture> ("Image.jpg"));
 }

And yeah It seems Texture can load normally but Video still has some error (which I'm not sure its related but only this occurred)

 Uncaught (in promise) DOMException: Failed to load because no supported source was found.


Other configurations

alt text alt text

video (my bundle name) manifest

 ManifestFileVersion: 0
 ...
 Assets:
 - Assets/Video.renderTexture
 - Assets/Image.jpg
 - Assets/Hall.mov
 Dependencies: []


So my question is How to get video assets work in Android and WebGL? and Can't LoadFromFile use with WebGL? or Its can but I missed something?

Any suggestions would be appreciated. Thanks.

screen-shot-2017-04-19-at-54604-pm.png (76.7 kB)
screen-shot-2017-04-19-at-55928-pm.png (35.1 kB)
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 pilot888 · Jan 18, 2018 at 06:50 AM

i have the same problem in WEBGL,did you solve this problem??? how did you finish it!!! please tell you ,thank you !!!!,hello ,I have the same problem in WEBGL. Did you have solved this problem??? how did you solve it!!!

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

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

WebGL play video using VideoPlayer and StreamingAssets 2 Answers

WebGL VideoPlayer only Plays Once 0 Answers

Videoplayer Component in WebGL with OAuth2 url. 0 Answers

In Unity 2019.2.X WebGl Cache Clear Not Working ? 0 Answers

WebGL build crashes but game runs fine in editor and windows build. 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