mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-21 01:37:50 -05:00
Brought up to date with the private repository (feea4c7)
This commit is contained in:
1 parent
1aa738d692
commit
1b1df1ae48
7925 files changed
+2617237
-20
No files matched your search
@@ -0,0 +1,55 @@
|
||||
package org.osmf.elements
|
||||
{
|
||||
import org.osmf.elements.loaderClasses.LoaderUtils;
|
||||
import org.osmf.media.MediaResourceBase;
|
||||
import org.osmf.media.MediaType;
|
||||
import org.osmf.media.MediaTypeUtil;
|
||||
import org.osmf.media.URLResource;
|
||||
import org.osmf.traits.LoadTrait;
|
||||
import org.osmf.traits.LoaderBase;
|
||||
import org.osmf.utils.*;
|
||||
|
||||
public class ImageLoader extends LoaderBase
|
||||
{
|
||||
|
||||
private static const MIME_TYPES_SUPPORTED:Vector.<String> = Vector.<String>(["image/png","image/gif","image/jpeg"]);
|
||||
|
||||
private static const MEDIA_TYPES_SUPPORTED:Vector.<String> = Vector.<String>([MediaType.IMAGE]);
|
||||
|
||||
private var checkPolicyFile:Boolean;
|
||||
|
||||
public function ImageLoader(checkPolicyFile:Boolean = true)
|
||||
{
|
||||
super();
|
||||
this.checkPolicyFile = checkPolicyFile;
|
||||
}
|
||||
|
||||
override public function canHandleResource(resource:MediaResourceBase) : Boolean
|
||||
{
|
||||
var url:URL = null;
|
||||
var rt:int = MediaTypeUtil.checkMetadataMatchWithResource(resource,MEDIA_TYPES_SUPPORTED,MIME_TYPES_SUPPORTED);
|
||||
if(rt != MediaTypeUtil.METADATA_MATCH_UNKNOWN)
|
||||
{
|
||||
return rt == MediaTypeUtil.METADATA_MATCH_FOUND;
|
||||
}
|
||||
var urlResource:URLResource = resource as URLResource;
|
||||
if(urlResource != null && urlResource.url != null)
|
||||
{
|
||||
url = new URL(urlResource.url);
|
||||
return url.path.search(/\.gif$|\.jpg$|\.png$/i) != -1;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
override protected function executeLoad(loadTrait:LoadTrait) : void
|
||||
{
|
||||
LoaderUtils.loadLoadTrait(loadTrait,updateLoadTrait,false,this.checkPolicyFile);
|
||||
}
|
||||
|
||||
override protected function executeUnload(loadTrait:LoadTrait) : void
|
||||
{
|
||||
LoaderUtils.unloadLoadTrait(loadTrait,updateLoadTrait);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user