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 /
  • Help Room /
avatar image
0
Question by bc10000 · Nov 26, 2016 at 12:55 AM · resourcesstreamingassetswww class

Unable to acess video file inside my apk from unity

Greetings,

I am developing an android application, and i need to access a video file (.mp4) which is located inside the apk.

Basically I have native C program that utilize FFMPEG to take a video file , open it, decode it and extract all the frames from it. I have already confirmed the operation of this code. However the code will not work without a proper video file location being passed in to it in the first place.

I have placed my (.mp4) file inside Assets\StreamingAssets folder and I build the apk using unity.

I have followed the instructions on the unity streamingAssets manual https://docs.unity3d.com/ScriptReference/Application-streamingAssetsPath.html but I have not be able to achieve the expected results.

Basically the

  filePath = System.IO.Path.Combine(Application.streamingAssetsPath, "video.mp4");

Will return the location of the video correctly

 "jar:file:///:.................................!/assets/video.mp4";

but once i pass this string into my C function, the C function that opens the video stream does not operate.

This was not a problem when I provided the location of the file from a windows platform, but when I provide the location from within the apk, it simply doesn't work.

My guess is that since the apk is compressed jar file then I must somehow decompress it before i can get access to the video location properly. is it correct to assume that the WWW object will do the decompressing ? I read the unity Manuel on the WWW class and it doesn't say anything about being able to decompress a .jar file.

I have also read these forms http://answers.unity3d.com/questions/210909/android-streamingassets-file-access.html

http://stackoverflow.com/questions/8246917/how-to-access-unity-assets-natively-on-android-or-iphone

Here is my current code

     [DllImport("libnative-lib")]
     static extern int DecoderFunction(string filename);
 .
 .
 .
 .
 .    
 void Start()
     {
         filePath = System.IO.Path.Combine(Application.streamingAssetsPath, "Italy2.mp4");
 
         WWW www = new WWW(filePath);
         while (!www.isDone) {}
 
         // Decoding the video into frames
         Num = DecoderFunction(www.text); // This function is implemented in C
     }


My native C code is compiled into (.so file which is a dynamically linked file for android platforms). Is it even possible to have the native C code access a directory which is located inside an apk?

I just need guidance in the right direction.

Thank you all.

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

0 Replies

· Add your reply
  • Sort: 

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

78 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity can not access StreamingAssets on IOS 1 Answer

Failed to re-package resources 0 Answers

CommandInvocationFailed 1 Answer

Keep a file from assets after build 0 Answers

Loading JSON from StreamingAssets on android(c#) 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