| 1 | package com.longtailvideo.jwplayer.view { |
|---|
| 2 | import com.longtailvideo.jwplayer.model.PlayerConfig; |
|---|
| 3 | import com.longtailvideo.jwplayer.player.Player; |
|---|
| 4 | import com.longtailvideo.jwplayer.view.components.ControlbarComponent; |
|---|
| 5 | import com.longtailvideo.jwplayer.view.components.ControlbarComponentV4; |
|---|
| 6 | import com.longtailvideo.jwplayer.view.components.DisplayComponent; |
|---|
| 7 | import com.longtailvideo.jwplayer.view.components.DockComponent; |
|---|
| 8 | import com.longtailvideo.jwplayer.view.components.PlaylistComponent; |
|---|
| 9 | import com.longtailvideo.jwplayer.view.interfaces.IControlbarComponent; |
|---|
| 10 | import com.longtailvideo.jwplayer.view.interfaces.IDisplayComponent; |
|---|
| 11 | import com.longtailvideo.jwplayer.view.interfaces.IDockComponent; |
|---|
| 12 | import com.longtailvideo.jwplayer.view.interfaces.IPlaylistComponent; |
|---|
| 13 | import com.longtailvideo.jwplayer.view.interfaces.ISkin; |
|---|
| 14 | import com.longtailvideo.jwplayer.view.skins.SWFSkin; |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | public class PlayerComponents { |
|---|
| 18 | private var _controlbar:IControlbarComponent; |
|---|
| 19 | private var _display:IDisplayComponent; |
|---|
| 20 | private var _dock:IDockComponent; |
|---|
| 21 | private var _playlist:IPlaylistComponent; |
|---|
| 22 | private var _config:PlayerConfig; |
|---|
| 23 | private var _skin:ISkin; |
|---|
| 24 | |
|---|
| 25 | private var _player:Player; |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | public function PlayerComponents(player:Player) { |
|---|
| 29 | _player = player; |
|---|
| 30 | _skin = player.skin; |
|---|
| 31 | _config = player.config; |
|---|
| 32 | |
|---|
| 33 | if (_skin is SWFSkin) { |
|---|
| 34 | _controlbar = new ControlbarComponentV4(_player); |
|---|
| 35 | } else { |
|---|
| 36 | _controlbar = new ControlbarComponent(_player); |
|---|
| 37 | } |
|---|
| 38 | _display = new DisplayComponent(_player); |
|---|
| 39 | _playlist = new PlaylistComponent(_player); |
|---|
| 40 | _dock = new DockComponent(_player); |
|---|
| 41 | } |
|---|
| 42 | |
|---|
| 43 | |
|---|
| 44 | public function get controlbar():IControlbarComponent { |
|---|
| 45 | return _controlbar; |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | public function get display():IDisplayComponent { |
|---|
| 50 | return _display; |
|---|
| 51 | } |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | public function get dock():IDockComponent { |
|---|
| 55 | return _dock; |
|---|
| 56 | } |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | public function get playlist():IPlaylistComponent { |
|---|
| 60 | return _playlist; |
|---|
| 61 | } |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | private function set controlbar(bar:IControlbarComponent):void { |
|---|
| 65 | _controlbar = bar; |
|---|
| 66 | } |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | public function resize(width:Number, height:Number):void { |
|---|
| 70 | _display.resize(width, height); |
|---|
| 71 | _display.x = Number(_player.config.pluginConfig('display')['x']); |
|---|
| 72 | _display.y = Number(_player.config.pluginConfig('display')['y']); |
|---|
| 73 | |
|---|
| 74 | _controlbar.resize(width, height); |
|---|
| 75 | _controlbar.x = Number(_player.config.pluginConfig('controlbar')['x']); |
|---|
| 76 | _controlbar.y = Number(_player.config.pluginConfig('controlbar')['y']); |
|---|
| 77 | |
|---|
| 78 | |
|---|
| 79 | } |
|---|
| 80 | } |
|---|
| 81 | } |
|---|