source: branches/4.2/com/jeroenwijering/player/Player.as @ 68

Revision 68, 3.1 KB checked in by jeroen, 5 years ago (diff)

added new feeditems, polished simple/thin skins and made sure large YT images are loaded by default

  • Property svn:executable set to *
  • Property svn:keywords set to Rev
RevLine 
[1]1/**
2* Player that crunches through all media formats Flash can read.
3**/
4package com.jeroenwijering.player {
5
6
7import com.jeroenwijering.player.*;
[49]8import com.jeroenwijering.plugins.*;
[1]9import com.jeroenwijering.utils.Configger;
10import flash.display.MovieClip;
11import flash.events.Event;
12
13
14public class Player extends MovieClip {
15
16
[68]17        /** A list with all default configuration values. Change them to hard-code your preferences. **/
18        public var config:Object = {
[1]19                author:undefined,
20                description:undefined,
[68]21                date:undefined,
[14]22                duration:0,
[68]23                file:undefined,
[1]24                image:undefined,
[10]25                link:undefined,
[1]26                start:0,
[68]27                tags:undefined,
[1]28                title:undefined,
29                type:undefined,
30
[49]31                backcolor:undefined,
32                frontcolor:undefined,
33                lightcolor:undefined,
34                screencolor:undefined,
35
[5]36                controlbar:'bottom',
[45]37                controlbarsize:20,
[49]38                height:300,
[66]39                icons:true,
[1]40                logo:undefined,
[68]41                playlist:'none',
[1]42                playlistsize:180,
[3]43                skin:undefined,
[49]44                width:400,
[1]45
46                autostart:false,
[68]47                bufferlength:1,
[1]48                displayclick:'play',
49                item:0,
50                mute:false,
51                quality:true,
[45]52                repeat:'none',
[46]53                shuffle:false,
[49]54                state:'IDLE',
[10]55                stretching:'uniform',
[52]56                volume:80,
[1]57
[37]58                abouttext:undefined,
[45]59                aboutlink:"http://www.jeroenwijering.com/?item=JW_FLV_Player",
[49]60                client:undefined,
61                id:undefined,
[45]62                linktarget:'_blank',
[66]63                margins:'0,0',
[45]64                plugins:undefined,
[48]65                streamer:undefined,
66                token:undefined,
[66]67                tracer:undefined,
[68]68                version:'4.2.67'
[1]69        };
[68]70        /** Reference to all stage graphics. **/
71        public var skin:MovieClip;
[1]72        /** Object that loads all configuration variables. **/
73        private var configger:Configger;
[24]74        /** Object that load the skin and plugins. **/
[49]75        private var loader:SWFLoader;
[1]76        /** Reference to the Controller of the MVC cycle. **/
77        private var controller:Controller;
78        /** Reference to the model of the MVC cycle. **/
79        private var model:Model;
[68]80        /** Reference to the View of the MVC cycle, which defines all API calls. **/
81        public var view:View;
[1]82
83
[68]84        /**
85        * Constructor; initializes and starts the player.
86        **/
[57]87        public function Player():void {
[24]88                visible = false;
[68]89                skin = this.player;
90                addEventListener(Event.ADDED_TO_STAGE,loadConfig);
[66]91        };
92
93
94        /** When added to stage, the player loads the config. **/
[68]95        private function loadConfig(evt:Event):void {
[3]96                configger = new Configger(this);
[68]97                configger.addEventListener(Event.COMPLETE,loadSkin);
98                configger.load(config);
[1]99        };
100
101
102        /** Config loading completed; now load skin. **/
[68]103        private function loadSkin(evt:Event):void {
[49]104                loader = new SWFLoader(this);
[68]105                loader.addEventListener(Event.COMPLETE,loadMVC);
106                loader.loadSkin(config['skin']);
[1]107        };
108
109
[60]110        /** Skin loading completed, now load MVC. **/
[68]111        private function loadMVC(evt:Event):void {
112                controller = new Controller(config,skin);
113                model = new Model(config,skin,controller);
114                view = new View(config,skin,controller,model,loader);
115                controller.start(model,view);
116                loadPlugins();
[49]117        };
118
119
[68]120        /** MVC inited; now load plugins. **/
121        private function loadPlugins() {
[66]122                new Rightclick().initializePlugin(view);
123                new Display().initializePlugin(view);
124                new Controlbar().initializePlugin(view);
[68]125                if(skin['playlist']) { new Playlist().initializePlugin(view); }
126                loader.loadPlugins(config['plugins']);
[66]127                visible = true;
[49]128        };
129
130
[1]131}
132
133
134}
Note: See TracBrowser for help on using the repository browser.