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 Paden · Feb 20, 2018 at 06:50 PM · androidfile-iovideos

Accessing Videos on Android Device

I am creating an application that allows a user to queue up videos that they would like to watch within the application. On Mac, in order to access the videos, it is as simple as:

 DirectoryInfo dir = new DirectoryInfo(VIDEO_PATH);
 FileInfo[] info = dir.GetFiles("*.*");

However, when I build on the Android device itself, it is throwing an error: "UnauthorizedAccessException: Access to path '/storage/emulated/0/DCIM/VR Videos' is denied."

How do I get it to allow me into that folder? I don't want to include all the videos in the apk itself as it would be huge and I want to be able to add new videos without needing to re-export another apk.

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 shuaibimran · Jun 15, 2018 at 11:10 AM 0
Share

did you find any solution for this specific path problem

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Legend_Bacon · Feb 20, 2018 at 07:13 PM

Hello there,

On Android things get a little bit more complicated. GetFiles() is not guaranteed to work as intended, as many files and folders get zipped into a .jar. THIS POST explains it a little more in details.

Usually, the best solution is to use Application.PersistentDataPath. You may need to rewrite a little bit of code, but it works on both Android and Windows without issues. It should also just run on Mac, although I've never tested myself to give you a 100% on that.


I hope that helps!

Cheers,

~LegendBacon

Comment
Add comment · Show 2 · 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 Paden · Feb 20, 2018 at 07:35 PM 0
Share

Hey @Legend_Bacon would that mean I would need to place all my videos in the PersistentDataPath? I am trying to avoid having the videos directly associated to the .apk itself (that way they won't get zipped into a .jar), and I would like to place the videos anywhere I'd like on the phone and be able to grab them from within the app. Any ideas?

avatar image Legend_Bacon Paden · Feb 21, 2018 at 12:48 AM 0
Share

Pretty much. I am guessing you download the videos, so just save them to Application.PersistentDataPath ins$$anonymous$$d of what you are currently doing. Also just in case, THIS mayhelp you.

Cheers,

~LegendBacon

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

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

Related Questions

android browse and read text files 1 Answer

downloading file, saving on android 1 Answer

Android: Writing persistent data to SD Card 2 Answers

StreamingAssets folder ANDROID 0 Answers

Download and saving .txt from server to Android 1 Answer


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