Skip to content

Commit

Permalink
Copy all config properties to Flash PlayerConfig for 3rd party Flash …
Browse files Browse the repository at this point in the history
…providers [#91604828]
  • Loading branch information
Rob Walch committed Jul 21, 2015
1 parent 3590259 commit ce8dd9e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 16 deletions.
7 changes: 3 additions & 4 deletions src/flash/com/longtailvideo/jwplayer/media/MediaProvider.as
Original file line number Diff line number Diff line change
Expand Up @@ -354,12 +354,11 @@ public class MediaProvider extends Sprite implements IMediaProvider {
}

/**
* DEPREICATED IN JW7
*
* DEPRECATED IN JW7
* _stretch - no longer stored in provider
*
*/
private function noop(...args):void {}
private function noop(...args):void {
}

protected function get _stretch():Boolean {
return false;
Expand Down
44 changes: 32 additions & 12 deletions src/flash/com/longtailvideo/jwplayer/model/PlayerConfig.as
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ import com.longtailvideo.jwplayer.player.PlayerVersion;
import com.longtailvideo.jwplayer.plugins.PluginConfig;
import com.longtailvideo.jwplayer.utils.Logger;
import com.longtailvideo.jwplayer.utils.RootReference;
import com.longtailvideo.jwplayer.utils.Stretcher;

import flash.events.EventDispatcher;
import flash.media.SoundTransform;
import flash.utils.getQualifiedClassName;
import flash.ui.Mouse;
import flash.ui.MouseCursor;
import flash.utils.getQualifiedClassName;

public dynamic class PlayerConfig extends EventDispatcher {

protected var _debug:String = Logger.NONE;
protected var _id:String = "";
protected var _stretching:String = "uniform";
protected var _stretching:String = Stretcher.UNIFORM;
protected var _fullscreen:Boolean = false;
protected var _plugins:Array = [];
protected var _pluginConfig:Object = {};
Expand Down Expand Up @@ -78,16 +79,27 @@ public dynamic class PlayerConfig extends EventDispatcher {
return 0;
}

public function set width(w:Number):void {}
public function set width(w:Number):void {
}

public function set height(h:Number):void {}
public function set height(h:Number):void {
}

public function get stretching():String {
return _stretching;
}

public function set stretching(mode:String):void {
_stretching = mode ? mode.toLowerCase() : "";
mode = mode.toLowerCase();
switch (mode) {
case Stretcher.EXACTFIT:
case Stretcher.FILL:
case Stretcher.NONE:
case Stretcher.UNIFORM:
_stretching = mode;
return;
}
_stretching = Stretcher.UNIFORM;
}

public function get plugins():Array {
Expand Down Expand Up @@ -221,19 +233,27 @@ public dynamic class PlayerConfig extends EventDispatcher {
}

public function setConfig(config:Object):void {
this.id = config.id;
// add dynamic properties from js config
for (var key:String in config) {
// exclude builtin properties
if (!this.hasOwnProperty(key)) {
this[key] = config[key];
}
}

// make sure these setters are invoked
this.id = config.id;
this.debug = config.debug;
this.volume = config.volume;
this.mute = config.mute;
this.controls = config.controls;

if (config.stretching) {
this.stretching = config.stretching;
}

this.volume = config.volume;
this.mute = config.mute;

// this.fullscreen = config.fullscreen;
this.plugins = config.flashPlugins;
this.plugins = config.flashPlugins;

this.controls = config.controls;
this.captionLabel = config.captionLabel;
this.qualityLabel = config.qualityLabel;
}
Expand Down

0 comments on commit ce8dd9e

Please sign in to comment.