• 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
Question by GeminiDeveloper · Oct 05, 2016 at 07:00 AM · iosurlaudioclip www load

[iOS] WWW class GetAudioClip unsupported URL

Hello everyone,

Currently on our project I'm saving audio from microphone on the mobile device and saving it as a .wav file successfully to the file system (Application.persistentDataPath). Then I'm using WWW class to access the audio file and using it for playback.

It works completely fine on Editor and Android. But when I built the project for iOS it just doesn't work. I tried to debug and on the Xcode console there is this error:

Error: Cannot create FMOD::Sound instance for resource \245 , (Operation could not be performed because specified sound/DSP connection is not ready. )

Firstly I thought that was the FMOD problem (which I'm not even using). After long searches on the web I found out that the problem was from the WWW class. I debugged the WWW class and found that the error is "unsupported URL". When I'm using WWW to get the file, I use (file://) prefix.

Before the www load, I used System.IO to check if the .wav file exists, then load the audio file with www class. I printed the data path every time I use www and checked if there is a case sensitivity problem. Paths are exactly the same. I'm using Coroutines for getting the data with www class. Here is the code:

 public IEnumerator loadAudioFromDisk()
 {
     
     pathBuilder = new StringBuilder();
 
     if(currentRecordNum == 0)
     {
         pathBuilder.Append("file://").Append(recordPath1);
     }
     else
     {
         pathBuilder.Append("file://").Append(recordPath2);
     }
 
     string path = pathBuilder.ToString();
     Debug.Log("Trying to get AudioClip from " + path);
     www = new WWW(path);
 
     while(!www.isDone)
     {
         yield return www;
         if (!string.IsNullOrEmpty(www.error))
             Debug.Log(www.error);
     }
 
     loadedAudio = www.GetAudioClip(false,true,AudioType.WAV);
 
 
     if(loadedAudio.loadState == AudioDataLoadState.Loaded)
     {
         playback.setAudioClip(loadedAudio,0);
 
         playback.playButton.SetActive(true);
 
         Debug.Log("Record Loaded");
 
         www.Dispose();
     }
 
 }


I also tried not using the yield inside while loop, didn't work. Also tried changing the streaming flag to false when getting the audio clip. At this point I'm starting to think that this is an Unity bug. Strange thing is, it works on Android and Editor completely fine. Anyone can help me with this problem?

Thanks!

Comment

People who like this

0 Show 0
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
Best Answer

Answer by GeminiDeveloper · Oct 05, 2016 at 08:59 AM

Well this is embarrassing. I found out that the name of the audio file which had spaces in the name (Ex: "audio file.wav") was causing the problem. Turns out you are not supposed to use spaces even on the name of the audio file in iOS.

Going to leave it here just in case someone else will have the same problem.

Comment

People who like this

0 Show 0 · 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

87 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

Related Questions

Play video with ARKit 0 Answers

Is app infected? Getting a lot of strange "CanOpenURL: failed" in Xcode 1 Answer

Finding physical world x,y,z with respect to an iOS device camera 2 Answers

Using touch (swiping) to move an object [C#] 1 Answer

Ship appears / disappears from the screen 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