diff --git a/.gitignore b/.gitignore index dd6df92..a9f2a7d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,9 +4,12 @@ bin-debug/ # Flash Builder +.settings .flexProperties +.flexLibProperties .actionScriptProperties .project +bin # Maven target/ @@ -23,4 +26,3 @@ rsync.sh rsync_vanilla.sh libs/ Flash Player Debugger.app/ - diff --git a/src/main/actionscript/com/castlabs/dash/DashPlugin.as b/src/main/actionscript/com/castlabs/dash/DashPlugin.as index 8a55730..e37531b 100644 --- a/src/main/actionscript/com/castlabs/dash/DashPlugin.as +++ b/src/main/actionscript/com/castlabs/dash/DashPlugin.as @@ -1,42 +1,55 @@ -/* - * Copyright (c) 2014 castLabs GmbH - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -package com.castlabs.dash { -import flash.display.Sprite; - -import org.osmf.elements.VideoElement; -import org.osmf.media.MediaElement; -import org.osmf.media.MediaResourceBase; -import org.osmf.media.PluginInfo; - -public class DashPlugin extends Sprite { - private var _pluginInfo:PluginInfo; - - public function DashPlugin() { - super(); - - if (this.root.loaderInfo.parameters.log == "true") { - DashContext.getInstance().console.enable(); - } - - _pluginInfo = new DashPluginInfo(); - } - - public function get pluginInfo():PluginInfo { - return _pluginInfo; - } - - public static function canHandleResource(resource:MediaResourceBase):Boolean { - return true; - } - - public static function mediaElementCreationFunction():MediaElement { - return new VideoElement(null, DashContext.getInstance().dashNetLoader); - } -} -} +/* + * Copyright (c) 2014 castLabs GmbH + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +package com.castlabs.dash { +import flash.display.Sprite; + +import org.osmf.elements.VideoElement; +import org.osmf.media.MediaElement; +import org.osmf.media.MediaResourceBase; +import org.osmf.media.PluginInfo; +import org.osmf.media.URLResource; + +public class DashPlugin extends Sprite { + private var _pluginInfo:PluginInfo; + + public function DashPlugin() { + super(); + + if (this.root.loaderInfo.parameters.log == "true") { + DashContext.getInstance().console.enable(); + } + + _pluginInfo = new DashPluginInfo(); + } + + public function get pluginInfo():PluginInfo { + return _pluginInfo; + } + + public static function canHandleResource(resource:MediaResourceBase):Boolean { + + var urlResource:URLResource = resource as URLResource; + + if (!urlResource || !urlResource.url) + { + return false; + } + + var url:String = urlResource.url; + + return /\.mpd/i.test(url) + || /\.dash/i.test(url) + ; + } + + public static function mediaElementCreationFunction():MediaElement { + return new VideoElement(null, DashContext.getInstance().dashNetLoader); + } +} +}