Emerging Stream Error #2032 in Adobe AIR application on Mac OS Sierra, help needed - actionscript-3

I'm trying to help out a client with an Adobe AIR application that suddenly stopped working on Mac OS Sierra. I haven't developed the app myself, so I am trying to do my best to solve the problem. It's essentially a Flex application written in Actionscript 3. When I was debugging I can see that I am getting the following error:
[ERROR] Error #2032: Stream Error.
The way the application works is that it first makes a web request to the server and gets an XML with a number of songs. No problem there.
After that the application downloads the first song in the XML result and starts playing.
When the first song starts playing the application then downloads the second song in the XML-list, when that download is finished it starts downloading the next one and so forth. The files being downloaded seems to be rather large, a couple of MB's.
So the first download works just fine, but all the other track downloads fails with Stream Error #2032. It seems I dont get any response headers from the failed requests, only the first one. I have a crossdomain.xml on the server.
This app works just fine on Mac OS X El Capitan and Windows, but with Sierra I am getting this error. The code is not that complex, it makes an API URL Request with an URLLoader and saves the file to disk. I have also tried using URLStream instead, same issue.
This is some of the code for example:
public function downloadTrack(track:Object, storeName:String, apiKey:String):void {
this.setCurrentTrack(track);
this.urlParameters.storeName = storeName;
this.urlParameters.keystring = apiKey;
this.urlLoader = new URLLoader();
this.urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
this.urlRequest = new URLRequest("/api/" + 'download/' +
this.currentTrack.id + "?time=" + new Date().getTime());
this.urlRequest.method = URLRequestMethod.POST;
this.urlRequest.data = this.urlParameters;
this.addEventListeners();
this.urlLoader.load(this.urlRequest);
}
private function loaded(e:Event):void {
this.fileData = e.target.data;
writeFile();
}
private function writeFile():void {
var filePath:String = this.currentTrack.md5 + '.ogg';
var cacheFile:File = this.downloadDirectory.resolvePath('.' + filePath);
this.fileStream.addEventListener(Event.CLOSE, saveReady);
this.fileStream.openAsync(cacheFile, FileMode.WRITE);
this.fileStream.writeBytes(fileData,0,fileData.length);
this.fileStream.close();
}
In the addEventListeners()-method, event-listeners for the URLLoader is added, and it's the urlloader that fires the IOError.
A weird thing that has happened twice is that the app suddenly starts to work as normal and downloads all of the files successively. Then after a couple of minutes it starts acting up again and nothing works. I am really having a hard time to understand where the error lies. I am no Adobe AIR/Flex-expert, so maybe you can point me in the right direction? I am pretty close to giving up on this one.
Thanks!

Try to change the destination, probably you don't have permissions to
write there.
Use the latest AIR SDK
Would be much better if you will share the project where it reproduced so I could check on my machine

Related

Error #2036: Load Never Completed. URL: http://airdownload.adobe.com/air/browserapi/air.swf

UPDATE;
I've managed to reproduce this problem explained below locally - by disconnecting the local machine and clearing the browser cache. So the real question is; how can you load the air.swf file from a machine that is not connected to the 'net ? Or is there another way to launch an AIR application from SWF?
I have an AS3 application that is trying to launch a AIR application - it starts by loading the AIR SWF object and finding the currently installed version. My problem is that the AIR SWF object won't load. My code currently looks like the following;
private function getInstalledVersion():void {
var airLoader_adobe:Loader = new Loader();
loaderReferences["airLoader"] = airLoader_adobe;
airLoader_adobe.contentLoaderInfo.addEventListener(Event.COMPLETE, function(event:Event):void{
airswf = event.target.content;
trace(new Date(), "-- contentLoaderInfo airswf loaded, status =", airswf.getStatus(), "; fetching currently installed version");
airswf.getApplicationVersion(applicationId, publisherId, updateInstalledVersion);
delete loaderReferences["airLoader"];
});
airLoader_adobe.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function ( event:IOErrorEvent ):void
{
trace(new Date(), "-- contentLoaderInfo IO_ERROR;", event.target, event.toString());
delete loaderReferences["airLoader"];
});
var context_adobe:LoaderContext = new LoaderContext();
airLoader_adobe.load(new URLRequest('http://airdownload.adobe.com/air/browserapi/air.swf'), context_adobe);
}
Now, this works just fine in my local development environment. And in the local test environments. But for reason it's failing with an IO_ERROR in the customer environment; I'm getting the following in the logs ...
Thu Oct 23 15:41:31 GMT+0100 2014 -- contentLoaderInfo IO_ERROR; [object LoaderInfo] [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2036: Load Never Completed. URL: http://airdownload.adobe.com/air/browserapi/air.swf"]
I'm at a bit of a loss as to what can be causing this as I just can't reproduce this error locally. I'm told AIR is installed (and if I uninstall AIR locally I get a different error from that shown). I know the PC doesn't have access to the internet, but again locally if I disconnect from the network it's not required.
The only thing I can think of is that there is a policy on the Windows PC that is somehow blocking the loading of AIR within my SWF application - but I've no idea what this could be.
Does anyone have any pointers as to what could be going wrong, here?
Thanks.
Hmm, just to make sure I'm understanding it right:
You're downloading the air.swf in an AS3 project? Why not compile an AIR project directly?
You're trying to download the air.swf on a machine not connected to the internet? Of course you can't download something from the internet if you're not connected?
What do you mean by "customer environment?" Are you saying it works on your computer but not your customer's? Or is it when you run on your own computer in "developer mode" and "customer mode?" What does that mean?
Have you tried downloading something else? Like a random image from a server? Does that have the same result?
Sorry to put these questions in an "answer," but I think it'd be too long for a comment. Let me know and maybe I can help figure it out

as3 URLRequest lost connection - phone App

I am using as3 and the Flash Professional IDE to code an app for Droid and IOS. I have noticed a few times when downloading a file nearly 100 megs that it sometimes stops for both android and IOS. It will stay at a certain percentage and I have to close the app to try again.
I am wondering if there is a "BREAK" some how for a moment in the internet connection that the file no longer sees the URL request and just stops. Does this make sense? Is there a way to fix this?
Here is the line of code I am using. The var urlString comes is an http request. Its a zip file. Exmaple is:
var urlString = "http://myWebsite.com/French.zip";
var urlReq:URLRequest = new URLRequest(urlString);
UPDATE: I think I have to add a URLstream to it but still not sure how to do this. I am getting closer I think.

Using local file for Web Audio API in Javascript

I'm trying to get sound working on my iPhone game using the Web Audio API. The problem is that this app is entirely client side. I want to store my mp3s in a local folder (and without being user input driven) so I can't use XMLHttpRequest to read the data. I was looking into using FileSystem but Safari doesn't support it.
Is there any alternative?
Edit: Thanks for the below responses. Unfortunately the Audio API is horribly slow for games. I had this working and the latency just makes the user experience unacceptable. To clarify, what I need is sounething like -
var request = new XMLHttpRequest();
request.open('GET', 'file:///./../sounds/beep-1.mp3', true);
request.responseType = 'arraybuffer';
request.onload = function() {
context.decodeAudioData(request.response, function(buffer) {
dogBarkingBuffer = buffer;
}, onError);
}
request.send();
But this gives me the errors -
XMLHttpRequest cannot load file:///sounds/beep-1.mp3. Cross origin requests are only supported for HTTP.
Uncaught Error: NETWORK_ERR: XMLHttpRequest Exception 101
I understand the security risks with reading local files but surely within your own domain should be ok?
I had the same problem and I found this very simple solution.
audio_file.onchange = function(){
var files = this.files;
var file = URL.createObjectURL(files[0]);
audio_player.src = file;
audio_player.play();
};
<input id="audio_file" type="file" accept="audio/*" />
<audio id="audio_player" />
You can test here:
http://jsfiddle.net/Tv8Cm/
Ok, it's taken me two days of prototyping different solutions and I've finally figured out how I can do this without storing my resources on a server. There's a few blogs that detail this but I couldn't find the full solution in one place so I'm adding it here. This may be considered a bit hacky by seasoned programmers but it's the only way I can see this working, so if anyone has a more elegent solution I'd love to hear it.
The solution was to store my sound files as a Base64 encoded string. The sound files are relatively small (less than 30kb) so I'm hoping performance won't be too much of an issue. Note that I put 'xxx' in front of some of the hyperlinks as my n00b status means I can't post more than two links.
Step 1: create Base 64 sound font
First I need to convert my mp3 to a Base64 encoded string and store it as JSON. I found a website that does this conversion for me here - xxxhttp://www.mobilefish.com/services/base64/base64.php
You may need to remove return characters using a text editor but for anyone that needs an example I found some piano tones here - xxxhttps://raw.github.com/mudcube/MIDI.js/master/soundfont/acoustic_grand_piano-mp3.js
Note that in order to work with my example you're need to remove the header part data:audio/mpeg;base64,
Step 2: decode sound font to ArrayBuffer
You could implement this yourself but I found an API that does this perfectly (why re-invent the wheel, right?) - https://github.com/danguer/blog-examples/blob/master/js/base64-binary.js
Resource taken from - here
Step 3: Adding the rest of the code
Fairly straightforward
var cNote = acoustic_grand_piano.C2;
var byteArray = Base64Binary.decodeArrayBuffer(cNote);
var context = new webkitAudioContext();
context.decodeAudioData(byteArray, function(buffer) {
var source = context.createBufferSource(); // creates a sound source
source.buffer = buffer;
source.connect(context.destination); // connect the source to the context's destination (the speakers)
source.noteOn(0);
}, function(err) { console.log("err(decodeAudioData): "+err); });
And that's it! I have this working through my desktop version of Chrome and also running on mobile Safari (iOS 6 only of course as Web Audio is not supported in older versions). It takes a couple of seconds to load on mobile Safari (Vs less than 1 second on desktop Chrome) but this might be due to the fact that it spends time downloading the sound fonts. It might also be the fact that iOS prevents any sound playing until a user interaction event has occured. I need to do more work looking at how it performs.
Hope this saves someone else the grief I went through.
Because ios apps are sandboxed, the web view (basically safari wrapped in phonegap) allows you to store your mp3 file locally. I.e, there is no "cross domain" security issue.
This is as of ios6 as previous ios versions didn't support web audio api
Use HTML5 Audio tag for playing audio file in browser.
Ajax request works with http protocol so when you try to get audio file using file://, browser mark this request as cross domain request. Set following code in request header -
header('Access-Control-Allow-Origin: *');

Why does Milkman's StoreKit AS3 API seem to crash on second call to create()?

I recently started using the Milkman StoreKit native extension for in-App purchasing on IOS. I initially found it great and seemed to get it up and running fairly swiftly, however I can't get around one issue.
If I try to call StoreKit.create() a second time it appears to crash. The first time its prefect… I get the product info from the iTunes store, the purchase goes through and my app updates as intended. Any second attempt to create Storekit and it gets stuck on the Storekite.create() line of code. I even made a new app just to test this (to eliminate any errors I many have made) and again, first create() no problem, second one crashes. Below is my code on the tester app I made (just on the timeline).
import com.milkmangames.nativeextensions.ios.*;
import com.milkmangames.nativeextensions.ios.events.*;
import flash.events.MouseEvent;
function openStoreKit(e:MouseEvent):void {
var t:TraceOnStage = new TraceOnStage(stage,"startProcess" + StoreKit);
if (! StoreKit.isSupported()) {
var t:TraceOnStage = new TraceOnStage(stage,"not supported" + StoreKit);
return;
}
var t:TraceOnStage = new TraceOnStage(stage,"initialising" + StoreKit);
StoreKit.create();
var t:TraceOnStage = new TraceOnStage(stage,"initialised!");
}
stage.addEventListener(MouseEvent.MOUSE_UP, openStoreKit);
First call to openStoreKit() no problem.. I get "initialising[StoreKit]" in my trace out then "initalised". Second call just "initialising[StoreKit]" and crashes.
I have tried everything I can think of. I have recently updated to AIR 3.4 SDK, could it be to do with that? (I am using Flash Pro CS6)

AS3 Error #2044. Once dissmissed the app works fine

I'm working in as3 and my code is producing an error: "Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed."
Other then the fact that the app is producing this error and interrupting users who have a the debug version of the adobe flash player the app works just fine, I "Dismiss All" errors and
I've been debugging the program, stepping through one line at a time, trying to see exactly what it's failing to load and I can figure it out. From what research I've done it seems like the error is caused by urls being wrong or resources not being present, but as I've said, the app works exactly as expected.
here is a link to the app if you have debugger version of flash you'll see when it happens:
http://www.playmatics.com/parents_connect/
Assuming you are loading files off a server, I would suggest looking for server errors on file requests as this could be the source of your problem.
However, you might still want to properly handle the event thrown by the player in order to avoid the error from being displayed:
var loader:Loader = new Loader();
loader.addEventListener(IOErrorEvent.IOError, handleIOErrorEvent);
var urlReq:URLRequest = new URLRequest('srcURL');
loader.load(urlReq);
protected function handleIOErrorEvent(event:IOErrorEvent):void {
trace('handleIOErrorEvent: ' + event);
}
Hope this helps.
UPDATE
Not related to your problem... two files appear as not found – 404 errors – on your server:
http://www.playmatics.com/parents_connect/history/history.js
http://www.playmatics.com/parents_connect/history/history.css