source: trunk/fl5/src/com/longtailvideo/jwplayer/player/Player.as @ 293

Revision 293, 4.3 KB checked in by pablo, 4 years ago (diff)

Mute should have default boolean

Line 
1package com.longtailvideo.jwplayer.player {
2        import com.longtailvideo.jwplayer.controller.Controller;
3        import com.longtailvideo.jwplayer.events.PlayerEvent;
4        import com.longtailvideo.jwplayer.model.Model;
5        import com.longtailvideo.jwplayer.model.PlayerConfig;
6        import com.longtailvideo.jwplayer.model.Playlist;
7        import com.longtailvideo.jwplayer.plugins.IPlugin;
8        import com.longtailvideo.jwplayer.view.ISkin;
9        import com.longtailvideo.jwplayer.view.View;
10       
11        import flash.display.Sprite;
12        import flash.utils.setTimeout;
13       
14        /**
15         * Sent when the player has been initialized and skins and plugins have been successfully loaded.
16         *
17         * @eventType com.longtailvideo.jwplayer.events.PlayerEvent.JWPLAYER_READY
18         */
19        [Event(name="jwplayerReady", type = "com.longtailvideo.jwplayer.events.PlayerEvent")]
20
21
22        /**
23         * Main class for JW Flash Media Player
24         *
25         * @author Pablo Schklowsky
26         */
27        public class Player extends Sprite {
28                private var playerVersion:String = "5.0.1";
29               
30                private var model:Model;
31                private var view:View;
32                private var controller:Controller;
33
34                /** Player constructor **/
35                public function Player() {
36                        // Small pause to allow Javascript to catch up
37                        setTimeout(initializePlayer, 50);
38                }
39
40                /** Initialize the Player **/
41                protected function initializePlayer():void {
42                        model = new Model();
43                        view = new View();
44                        controller = new Controller(this, model, view);
45
46                        model.addGlobalListener(forward);
47                        view.addGlobalListener(forward);
48                        controller.addGlobalListener(forward);
49
50                        controller.setupPlayer();
51                }
52
53                /**
54                 * Forwards all MVC events to interested listeners.
55                 * @param evt
56                 */
57                protected function forward(evt:PlayerEvent):void {
58                        dispatchEvent(evt);
59                }
60
61                /**
62                 * The player's current configuration
63                 */
64                public function get config():PlayerConfig {
65                        return model.config;
66                }
67
68                /**
69                 * Player version getter
70                 */
71                public function get version():String {
72                        return this.playerVersion;
73                }
74
75                /**
76                 * Reference to player's skin.  If no skin has been loaded, returns null.
77                 */
78                public function get skin():ISkin {
79                        return view.skin;
80                }
81
82                /**
83                 * The current player state
84                 */
85                public function get state():String {
86                        return model.state;
87                }
88
89                /**
90                 * The player's playlist
91                 */
92                public function get playlist():Playlist {
93                        return model.playlist;
94                }
95
96                /**
97                 * Set to true when the player is blocking playback.
98                 */
99                public function get isBlocking():Boolean {
100                        return false;
101                }
102
103                /**
104                 * Request that the player block playback.  When the Player is blocking, the currently playing stream is
105                 * paused, and no new playback-related commands will be honored until <code>unblockPlayback</code> is
106                 * called.
107                 *
108                 * @param target Reference to plugin requesting playback blocking
109                 * @return <code>true</code>, if the blocking request is successful.  If another plugin is blocking,returns
110                 * <code>false</code>.
111                 */
112                public function blockPlayback(target:IPlugin):Boolean {
113                        return false;
114                }
115
116                /**
117                 * Unblocks the player.  If the player was buffering or playing when it was blocked, playback will resume.
118                 *
119                 * @param target Reference to the requesting plugin.
120                 * @return <code>true</code>, if <code>target</code> had previously requested player blocking.
121                 *
122                 */
123                public function unblockPlayback(target:IPlugin):Boolean {
124                        return false;
125                }
126               
127                public function volume(volume:Number):Boolean {
128                        return false;
129                }
130               
131                public function mute(state:Boolean=true):Boolean {
132                        return false;
133                }
134               
135                public function play():Boolean {
136                        return false;
137                }
138
139                public function pause():Boolean {
140                        return false;   
141                }
142               
143                public function stop():Boolean {
144                        return false;
145                }
146               
147                public function seek(position:Number):Boolean {
148                        return false;
149                }
150               
151                public function load(item:*):Boolean {
152                        return false;
153                }
154               
155                public function playlistItem(index:Number):Boolean {
156                        return false;
157                }
158               
159                public function playlistNext():Boolean {
160                        return false;
161                }
162
163                public function playlistPrev():Boolean {
164                        return false;
165                }
166               
167                public function redraw():Boolean {
168                        return false;
169                }
170       
171                public function fullscreen(on:Boolean=true):Boolean {
172                        return false;
173                }
174               
175                public function link(index:Number=NaN):Boolean {
176                        return false;
177                }
178
179        }
180}
Note: See TracBrowser for help on using the repository browser.