Download and play audio files from Server
Hi guys, I am trying to download an audio file from my server and play it. Sound simple (get it?).
I have got it working find on neko, but I have a problem when I make an android version.
when I try to write to the assets/music folder the app crashes. I think maybe its to do with the fact is compiled to an APK file and no longer sees this a an accessible folder. ??
I have tried making a another folder, but crashes it as well.
Does anyone have experience of this. Thanks Lee
import sys.FileSystem; import Sys; import sys.io.File; var content : String = haxe.Http.requestUrl("http://cookiebytes.co.uk/video/rubbish.ogg"); sys.io.File.write("assets/music/054377431-halloween.ogg", true).writeString(content); trace(content.length + " bytes downloaded"); FlxG.sound.playMusic("assets/music/054377431-halloween.ogg",0.5);
Didn't try it yet myself, but I read you have to sign apk with permissions, for example, in Project.xml:
Yes, I already have this line in my project.XML, but still no luck.
Bump, Seems my help request is going cold, so I though I might add to see if anyone could help.
As my game progresses I would like to get assets from my server to expand the game without having a massive APK file at the beginning . I have been trying various different ways for days now with no luck.
This is how I imagined the In app purchasing to work, (or have I got this wrong?)
If I cant download the file, then at least can I play it straight from the server?. Although this won't help me later when I need extra graphics.
Please can someone help or point me in the right direction, This downloading would be essential to my game. Lee