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;
 sound.load(new URLRequest(""));;

ive tried some other methods like

    var mp = new URLLoader(new URLRequest(""));
    mp.addEventListener(Event.COMPLETE, function(v:Event){
        var endres = ByteArray.fromBytes(Bytes.ofString(;
        var mpfile = new Sound();
        mpfile.loadPCMFromByteArray(endres, 1);;

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() {
 addEventListener(Event.ADDED_TO_STAGE, addedToStage);
 function addedToStage(e:Event):Void 

  stage.addEventListener(MouseEvent.CLICK, audioOutput );

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



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 ‘’ 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