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 neoc999 · Aug 16, 2017 at 11:43 AM · errorvideomoviesystem.iohandheld

UnauthorizedAccessException: Access to the path 'path to file' is denied.

I'm looking for a way to download, save and play movies on Handheld devices. But everytime I build it to iOS and play it I get the UnauthorizedAccessException when it is trying the FileStream. At this point I'm totally stuck.......

Also couldn't find any other working solutions anywhere online.

Unity 5.6.3

using UnityEngine; using System.Collections; using System.IO;

public class movieStream : MonoBehaviour {

 private string videoName = "your-video-file.mp4";
 private string path;

 void Start()
 {
     Debug.Log("Initiated");
     StartCoroutine(DownloadAndPlayVideo());        
 }

 IEnumerator DownloadAndPlayVideo()
 {
     Debug.Log("IEnumerator Started");
     //Use this line when Android phone
     //path = Application.persistentDataPath + "/" + videoName;

     //Use this line when Iphone
     path = "file://" + Application.persistentDataPath + "/" + videoName;
     Debug.Log(path);

     WWW www = new WWW("https://img-9gag-fun.9cache.com/photo/aNzgP7A_460sv.mp4");
     yield return www;
     Debug.Log("Online movie found");

     if (www == null)
     {
         Debug.Log("www = Null");
     }

     else if (www.isDone)
     {
         Debug.Log("www is done");
     }
     else if (www.error != null)
     {
         Debug.Log("www has an error");
     }

     //Save the video to videoName location
     if (www != null && www.isDone && www.error == null)
     {
         Debug.Log("Save started");
         FileStream stream = new FileStream(videoName, FileMode.Create);
         stream.Write(www.bytes, 0, www.bytes.Length);
         stream.Close();
     }

     Debug.Log("starting Handheld");
     Handheld.PlayFullScreenMovie(path, Color.black, FullScreenMovieControlMode.Full, FullScreenMovieScalingMode.AspectFill);
     Debug.Log("stopping Handheld");
 }

}

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

131 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

Related Questions

Handheld.PlayFullScreenMovie dont work, help 0 Answers

Cannot impory any video file. 0 Answers

Video won't show up on quad and Unity Hub can't create a new folder. 0 Answers

Access to the path is denied 0 Answers

WindowsVideoMedia Error 0X8007000e Wat dis do? 2 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