📄 flowplayerbase.as
字号:
if (props.zIndex == -1) { props.zIndex = newPluginZIndex; } log.debug("showPlugin, zIndex is " + props.zIndex); if (disp == playButtonOverlay.getDisplayObject()) { playButtonOverlay.getDisplayObject()["showButton"](); } else { _panel.addView(disp, null, props); } _pluginRegistry.updateDisplayProperties(props); }
/** * Removes the specified plguin display object from the panel. * @param view the display object to remove * @param props the {@link DisplayProperties display properties} to be used */ public function hidePlugin(disp:DisplayObject):void { if (disp.parent == screen && disp == playButtonOverlay.getDisplayObject()) { playButtonOverlay.getDisplayObject()["hideButton"](); } else { disp.parent.removeChild(disp); } var props:DisplayProperties = _pluginRegistry.getPluginByDisplay(disp); if (props) { props.display = "none"; _pluginRegistry.updateDisplayProperties(props); } } /** * Shows or hides the specied display object to/from the panel. * @param the display objet to be shown/hidden * @param props the DisplayProperties to be used if the plugin will be shown * @return <code>true</code> if the display object was shown, <code>false</code> if it went hidden * @see #showPlugin * @see #hidePlugin */ public function togglePlugin(disp:DisplayObject, props:DisplayProperties = null):Boolean { if (disp.parent == _panel) { hidePlugin(disp); return false; } else { showPlugin(disp, props); return true; } } /** * Gets the animation engine. */ public function get animationEngine():AnimationEngine { return _animationEngine; } /** * Gets the plugin registry. */ public function get pluginRegistry():PluginRegistry { return _pluginRegistry; } /** * Seeks to the specified target second value in the clip's timeline. */ public function seek(seconds:Number):FlowplayerBase { log.debug("seek to " + seconds + " seconds"); _playListController.seekTo(seconds); return this; } /** * Seeks to the specified point. * @param the point in the timeline, between 0 and 100 */ public function seekRelative(value:Number):FlowplayerBase { log.debug("seekRelative " + value + "%, clip is " + playlist.current); seek(playlist.current.duration * (value/100)); return this; } /** * Gets the current status {@link PlayStatus} */ public function get status():Status { return _playListController.status; } /** * Gets the player state. */ public function get state():State { return _playListController.getState(); } /** * Gets the playList. */ public function get playlist():Playlist { return _playListController.playlist; } /** * Gets the current clip (the clip currently playing or the next one to be played when playback is started). */ public function get currentClip():Clip { return playlist.current; } /** * Shows the specified error message in the player area. */ public function showError(message:String):void { _errorHandler.showError(message); } /** * Handles the specified error. */ public function handleError(error:PlayerError, info:Object = null, throwError:Boolean = true):void { _errorHandler.handleError(error, info); } /** * Gets the Flowplayer version number. * @return for example [3, 0, 0, "free", "release"] - the 4th element * tells if this is the "free" version or "commercial", the 5th * element specifies if this is an official "release" or a "development" version. */ public function get version():Array { // this is hacked like this because we cannot have imports to classes // that are conditionally compiled - otherwise this class cannot by compiled by compc // library compiler var VersionInfo:Class = Class(getDefinitionByName("org.flowplayer.config.VersionInfo")); return VersionInfo.version; } /** * Gets the player's id. */ public function get id():String { return _config.playerId; } /** * Loads the specified plugin. * @param plugin the plugin to load * @param callback a function to call when the loading is complete */ public function loadPlugin(pluginName:String, url:String, callback:Function):void { loadPluginLoadable(new Loadable(pluginName, _config, url), callback); } /** * Creates a text field with default font. If the player configuration has a FontProvider * plugin configured, we'll use that. Otherwise platform fonts are used, the platform font * search string used to specify the font is: * "Trebuchet MS, Lucida Grande, Lucida Sans Unicode, Bitstream Vera, Verdana, Arial, _sans, _serif" */ public function createTextField(fontSize:int = 12, bold:Boolean = false):TextField { if (fonts && fonts.length > 0) { return TextUtil.createTextField(true, fonts[0], fontSize, bold); } return TextUtil.createTextField(false, null, fontSize, bold); } protected function loadPluginLoadable(loadable:Loadable, callback:Function = null):void { var loaderCallback:Function = function():void { log.debug("plugin loaded"); _pluginRegistry.setPlayerToPlugin(loadable.plugin); if (loadable.plugin is DisplayPluginModel) { var displayPlugin:DisplayPluginModel = loadable.plugin as DisplayPluginModel; if (displayPlugin.visible) { log.debug("adding plugin to panel"); if (displayPlugin.zIndex < 0) { displayPlugin.zIndex = newPluginZIndex; } _panel.addView(displayPlugin.getDisplayObject(), null, displayPlugin); } } else if (loadable.plugin is ProviderModel){ _playListController.addProvider(loadable.plugin as ProviderModel); } if (callback != null) { callback(loadable.plugin); } }; _pluginLoader.loadPlugin(loadable, loaderCallback); }
private function get newPluginZIndex():Number { var play:DisplayProperties = _pluginRegistry.getPlugin("play") as DisplayProperties; if (! play) return 100; return play.zIndex; }
/** * Gets the fonts that have been loaded as plugins. */ public function get fonts():Array { return _pluginRegistry.fonts; } /** * Is the player in fullscreen mode? */ public function isFullscreen():Boolean { return _fullscreenManager.isFullscreen; } /** * Resets the screen and the controls to their orginal display properties */ public function reset(pluginNames:Array = null, speed:Number = 500):void { if (! pluginNames) { pluginNames = [ "controls", "screen" ]; } for (var i:Number = 0; i < pluginNames.length; i++) { resetPlugin(pluginNames[i], speed); } } /** * Configures logging. */ public function logging(level:String, filter:String = "*"):void { var config:LogConfiguration = new LogConfiguration(); config.level = level; config.filter = filter; Log.configure(config); } /** * Flowplayer configuration. */ public function get config():Config { return _config; } /** * Resource loader. */ public function createLoader():ResourceLoader { return new ResourceLoaderImpl(_config.playerId ? null : _playerSWFBaseURL, this); } private function resetPlugin(pluginName:String, speed:Number = 500):void { var props:DisplayProperties = _pluginRegistry.getOriginalProperties(pluginName) as DisplayProperties; if (props) { _animationEngine.animate(props.getDisplayObject(), props, speed); } } protected function checkPlugin(plugin:Object, pluginName:String, RequiredClass:Class = null):void { if (! plugin) { showError("There is no plugin called '" + pluginName + "'"); return; } if (RequiredClass && ! plugin is RequiredClass) { showError("Specifiec plugin '" + pluginName + "' is not an instance of " + RequiredClass); } } protected function get screen():Screen { return DisplayProperties(_pluginRegistry.getPlugin("screen")).getDisplayObject() as Screen; } protected function get playButtonOverlay():DisplayProperties { return DisplayProperties(_pluginRegistry.getPlugin("play")) as DisplayProperties; } //// private function onFullScreen(event:FullScreenEvent):void {// _eventHub.handlePlayerEvent(event.fullScreen ? PlayerEvent.fullscreen() : PlayerEvent.fullscreenExit());// }// // private function onPluginEvent(event:PluginEvent):void {// ExternalEvent.firePluginEvent(id, event.pluginName, event.methodName, null, event.eventObject);// } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -