Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

WWW In WEBPLAYER return Absolute URI is too short

Discussion in 'Scripting' started by neoneper, Jun 26, 2014.

  1. neoneper

    neoneper

    Joined:
    Nov 14, 2013
    Posts:
    48
    In my project I need to access an image using the WWW class!
    My game is in the same domain of the picture! And my game is a Browser Web Player.

    But when I access my test in the browser, the image is not loaded!

    Running my test in UnityEditor, I get this error message:

    UriFormatException: Absolute URI is too short
    Code (CSharp):
    1.  
    2.  string url = "http://www.royalpoker.com.br/images/avatares/julex2014-06-22.jpg";
    3.  Texture2D tmp;
    4.  IEnumerator GetWWW()
    5.   {
    6.  
    7.   WWW www = new WWW(url);
    8.  
    9.   yield return www; //UriFormatException: Absolute URI is too short
    10.  
    11.   if (www.error != null)
    12.   Debug.LogWarning(www.error);
    13.  
    14.   tmp = www.texture;
    15.    
    16.   }
    17.  
    I do not know the cause of this error but I figured what the problem might be occurring due to lack of crossdomain.xml file

    So, I put this file in the root of my domain (http://www.royalpoker.com.br), it content is the following!
    Code (CSharp):
    1. <?xml version="1.0" encoding="ASCII"?>
    2. <cross-domain-policy>
    3. <allow-access-from domain="*"/>
    4. </cross-domain-policy>
    5.  
    However, the same problem persists!

    Could someone do me the courtesy to explain to me the correct way for me to get a good result?

    I researched a lot here in the forum and on google but I found no solution to this problem. But I found several people with the same problem and are also unresolved!.
    I'll be really grateful for your help!
     
  2. zaxvax

    zaxvax

    Joined:
    Jun 9, 2012
    Posts:
    220
    Works fine for me. Your image is accessible for WWW in unity.
     
  3. NomadKing

    NomadKing

    Joined:
    Feb 11, 2010
    Posts:
    1,461
    Works for me too, both in Unity and as Webplayer build run from my desktop.

    I made this quick script and placed it on a Cube so I could see the results:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class WWWTest : MonoBehaviour {
    5.  
    6.     string url = "http://www.royalpoker.com.br/images/avatares/julex2014-06-22.jpg";
    7.     Texture2D tmp;
    8.  
    9.     void Start ()
    10.         {
    11.         StartCoroutine(GetWWW());
    12.         }
    13.  
    14.  
    15.     IEnumerator GetWWW()
    16.         {
    17.  
    18.           WWW www = new WWW(url);
    19.    
    20.           yield return www; //UriFormatException: Absolute URI is too short
    21.    
    22.           if (www.error != null)
    23.               Debug.LogWarning(www.error);
    24.    
    25.           //tmp = www.texture;
    26.           renderer.material.mainTexture = www.texture;
    27.  
    28.         }
    29. }
    Does this code work for you in the same way?
     
  4. neoneper

    neoneper

    Joined:
    Nov 14, 2013
    Posts:
    48
    To me, the problem remains , but now I found out the reason, but do not know how to fix!
    Using the property: "WWW Security Emulation", I managed to access the image as reading.

    My real need is to read texture that received by the WWW class, and I only get this when I'm not using WEB Player!
    So I suspect that:
    My WebPlayer, not being able to read this crossdomain.xml file on my domain root.

    Could this be the problem?
    And if so, how can I make my WebPlayer find the crossdomain.xml file ?

    Look the attachment of this post!
    This is the result I want to achieve. In this picture i did not perform in WebPlayer mode.


    Using the simple example that I put in the first post, I can only get the texture image but am not able to manipulate the image to create this effect! This is the reason I do not have access to reading pixels of this image. I read in the documentation that I can only read the texture if there is a crossdomain.xml in my area that I am accessing.

    The Problem is that I already put the crossdomain.xml in the domain root, but my WebPlayer not reading it!.
     

    Attached Files:

    • erro.jpg
      erro.jpg
      File size:
      40.2 KB
      Views:
      834
    Last edited: Jun 26, 2014
  5. NomadKing

    NomadKing

    Joined:
    Feb 11, 2010
    Posts:
    1,461
    I suspect that the issue is related to the domain, but it's not something I know enough about to be able to say what the exact problem is :(

    I did find mention on Unity Answers that the crossdomain.xml file must be in UTF-8 Format, or it doesn't work correctly.

    Also the Debugging section on this page talks about an environment variable you can enable to get more console messages, perhaps this may help you see what's happening.

    Sorry I can't be of more help.
     
  6. neoneper

    neoneper

    Joined:
    Nov 14, 2013
    Posts:
    48
    I do not believe that is the configuration problem of the hosting because I place on my local test server also. And the same happens on my server!

    I already did configured my system to read the LOG debug with the return of crossdomain.xml.
    When I run my project in the editor and access the LOG I get no message regarding crossdomain.xml

    But if I configure WWW Security Emulation, I can receive a message in the log file, referring to crossdomain. The problem is that he no is with the data I've set up in my domain in crossdomain.xml. It generates an automatic settings crossdomain.xml with him. I do not understand it!

    Look This:
    Game Teste - bug: http://www.royalpoker.com.br/game.html
    Crossdomain - xml: http://www.royalpoker.com.br/crossdomain.xml
    Image texture for download end Read: http://www.royalpoker.com.br/julex.jpg

    Everything is correct, but it just does not work!

    LOOK MY LOG:
    In my unityEditor i Configure WWW Security Emulation: http://www.royalpoker.com.br/game.unity3d
    And the result Log is:
    Note that these data are not correct! Not my crossdomain.xml file.
    If I run my project without configuring the WWW Security emulation, it does not return anything related to the crossdomain.xml and conseguentemente does not work!


    I'm very sad with these results! I can not see anything wrong that I can be doing!. Would be the case for send report to staff unity?
     
  7. umair_hassan1991

    umair_hassan1991

    Joined:
    Jun 27, 2018
    Posts:
    18
    Go to services, turn off collaboration & it will fix this issue.