Sound from URL not working on targets other than flash?

i tried to play some audio from an url and it only works on flash

 var sound = new openfl.media.Sound();
 sound.load(new URLRequest("http://someaudio.com/audio.mp3"));
 sound.play();

ive tried some other methods like

    var mp = new URLLoader(new URLRequest("http://audio.com/audio.mp3"));
    mp.addEventListener(Event.COMPLETE, function(v:Event){
        var endres = ByteArray.fromBytes(Bytes.ofString(mp.data));
        var mpfile = new Sound();
        mpfile.loadPCMFromByteArray(endres, 1);
        mpfile.play();
    });

but nothing i try seems to work, how can i load an audio from url on the HXCPP target?

On cpp targets use ogg format, mp3 not supported

Other reason can be that you need an interaction before you can play a sound. So try putting the code inside the button click.

nope, tried a ogg stream and still doesn’t work.

This works for me on html5

 class Main extends Sprite 
{

  public var  snd:Sound ;

public function new() {
	
super();
 addEventListener(Event.ADDED_TO_STAGE, addedToStage);
  }
 
 function addedToStage(e:Event):Void 
 {

  stage.addEventListener(MouseEvent.CLICK, audioOutput );
  }

  function audioOutput(e:MouseEvent):Void 
  {
    trace("audioOutput");
         snd = new  Sound();
       snd.addEventListener( Event.COMPLETE, audioLoaded );
   snd.load(new URLRequest("http://localhost:8000/test/a.mp3"));
 
  }
  function audioLoaded(e:Event):Void 
  {
     trace("audioLoaded");
  
     snd.play();

  }

  
	
}//class

It does show me CORS error in the console, but I can still hear the audio:

Access to XMLHttpRequest at ‘http://localhost:8000/test/a.mp3’ from origin ‘http://127.0.0.1:3000’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
Main.js:74170 GET http://localhost:8000/test/a.mp3 net::ERR_FAILED
u @ Main.js:74170
a @ Main.js:74170
load @ Main.js:74170
lime_media_AudioBuffer.loadFromFile @ Main.js:20238
load @ Main.js:65332
audioOutput @ Main.js:4183
__dispatchEvent @ Main.js:1131
__dispatch @ Main.js:1888
__dispatchStack @ Main.js:56195
__onMouse @ Main.js:57409
__onLimeMouseUp @ Main.js:57074
tmp @ Main.js:56895
dispatch @ Main.js:13683
handleMouseEvent @ Main.js:8554
Main.js:4974 myapp/Main.hx:46: audioLoaded