mercredi 15 février 2017

URLRequest works in Chrome, but not in Safari

The same URLRequest inside of a .swf works on Chrome, but not Safari

Chrome environment: Windows 10 + Chrome (56.0.2924.87) + Flash debugger 24,0,0,221

Mac environment (OS 10.11.06) + Safari (9.1.2) + Flash debugger 24.0

private function getAsset(url:String,callback:Function):void{
            var urlLoader:URLLoader = new URLLoader();
            var urlRequest:URLRequest = new URLRequest(url);

            urlLoader.addEventListener(Event.COMPLETE,callback);

            urlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR,function(e:SecurityErrorEvent):void{
                Debug.log( "Security error event", e );
            });
            urlLoader.addEventListener(IOErrorEvent.IO_ERROR,function(e:IOErrorEvent):void{
                Debug.log( "IO error event", e );
            });
            urlLoader.addEventListener(ErrorEvent.ERROR,function(e:ErrorEvent):void{
                Debug.log( "error event", e);
            });
            urlLoader.load(urlRequest);
        }

When this AS3 code is compiled into a .swf and run inside of Chrome, it works.
When this same code is run inside of Safari, it fails with an IOError:

Error #2032: Stream Error. URL: [url]

Why do I get an error in Safari, and not in Chrome?

The url (a .m3u8 file) is sensitive information, so I can't paste it here, but it is absolute (contains http://...) as opposed to a relative link

When the link is navigated to in Safari, you'd get a 403, but when the link is opened in Chrome, you'd download the file, which makes me think that it's a problem with the browser, and not with the code.

The project is compiled with Flash Builder 4.6, using Flex 4.6.0

Aucun commentaire:

Enregistrer un commentaire