Changeset 220

Show
Ignore:
Timestamp:
06/16/09 02:35:00 (5 months ago)
Author:
jeroen
Message:

string of small bugfixes

Files:
4 removed
21 modified

Legend:

Unmodified
Added
Removed
  • plugins/captions/com/jeroenwijering/plugins/Captions.as

    r217 r220  
    4242        /** Reference to the textfield. **/ 
    4343        public var field:TextField; 
     44        /** Reference to the background graphic. **/ 
     45        private var back:MovieClip; 
    4446        /** The array the captions are loaded into. **/ 
    4547        private var captions:Array; 
     
    6668 
    6769        private function drawClip():void { 
    68                 var rct:MovieClip = new MovieClip(); 
    69                 rct.graphics.beginFill(0x000000,0.6); 
    70                 rct.graphics.drawRect(0,0,400,60); 
     70                back = new MovieClip(); 
     71                back.graphics.beginFill(0x000000,0.75); 
     72                back.graphics.drawRect(0,0,400,20); 
     73                clip.addChild(back); 
    7174                format = new TextFormat(); 
    7275                format.color = 0xFFFFFF; 
     
    7881                field.width = 400; 
    7982                field.height = 10; 
    80                 field.y = 10; 
     83                field.y = 5; 
    8184                field.autoSize = "center"; 
    8285                field.selectable = false; 
     
    8487                field.wordWrap = true; 
    8588                field.defaultTextFormat = format; 
    86                 clip.addChild(rct); 
    8789                clip.addChild(field); 
    8890                if(config['back'] == false) { 
    89                         rct.alpha = 0; 
    90                         var ftr:DropShadowFilter = new DropShadowFilter(0,45,0,1,2,2,10,3); 
    91                         field.filters = new Array(ftr); 
     91                        back.alpha = 0; 
     92                        field.filters = new Array(new DropShadowFilter(0,45,0,1,2,2,10,3)); 
    9293                } 
    9394        }; 
     
    186187                } 
    187188                if(fnd == true && !captions) { 
    188                         field.htmlText = txt; 
     189                        field.htmlText = txt+' '; 
    189190                        resizeHandler(); 
    190191                        Logger.log(txt,'caption'); 
     
    195196        /** Resize the captions if the display changes. **/ 
    196197        private function resizeHandler(evt:ControllerEvent=undefined):void { 
     198                back.height = field.height + 10; 
    197199                clip.width = view.config['width']; 
    198200                clip.scaleY = clip.scaleX; 
    199                 if(config['back'] == false) { 
    200                         field.y = 50 - field.height; 
    201                 } 
    202201                clip.y = view.config['height']-clip.height; 
    203202        }; 
  • plugins/hd/com/jeroenwijering/plugins/HD.as

    r218 r220  
    106106                if(evt.data.bandwidth && !checked) { 
    107107                        checked = true; 
    108                         if((evt.data.bandwidth < config['bitrate']) == config['state']) { 
     108                        if(evt.data.bandwidth < config['bitrate'] && config['state']) { 
    109109                                clickHandler(); 
    110110                        } 
  • plugins/hd/hd.xml

    r217 r220  
    1919                        <default>1500</default> 
    2020                        <description> 
    21                                 Bitrate of the HD file to play.  
     21                                Bitrate of the HD file to play. 
    2222                                This is automatically picked up for HTTP streamed files, but not for RTMP streamed files. 
    2323                                Therefore you can set an HD bitrate through this flashvar. 
     
    4040                        </description> 
    4141                </flashvar> 
     42                <flashvar> 
     43                        <name>state</name> 
     44                        <default>true</default> 
     45                        <description> 
     46                                When false, the player will start with the low-quality video, no matter the bandwidth detected. 
     47                        </description> 
     48                </flashvar> 
    4249        </flashvars> 
    4350 
  • plugins/revolt/revolt.xml

    r173 r220  
    1010        <flashvars> 
    1111                <flashvar> 
    12                         <name>position</name> 
    13                         <default></default> 
    14                         <description>Position of the plugin. Over the display by default.</description> 
    15                 </flashvar> 
    16                 <flashvar> 
    17                         <name>size</name> 
    18                         <default></default> 
    19                         <description>Width or height of the plugin when not over the display.</description> 
    20                 </flashvar> 
    21                 <flashvar> 
    2212                        <name>gain</name> 
    2313                        <default>1</default> 
    2414                        <description>Amplicifation of the audio input for building the graphics. Set this higher (e.g. 1.5) for wilder graphics.</description> 
    25                 </flashvar> 
    26                 <flashvar> 
    27                         <name>simple</name> 
    28                         <default></default> 
    29                         <description>When set to "true", the plugin shows a simple waveform instead of the fancy, colorful graphics. The waveform will have the color of the "lightcolor" flashvar of the player.</description> 
    3015                </flashvar> 
    3116                <flashvar> 
  • plugins/snapshot/snapshot.xml

    r217 r220  
    99                It sends the JPG to a serverside script for processing and displays the returning URL. 
    1010                Note that the server hosting your FLV files needs to have a crossdomain XML for this. 
    11                 Here is a very basic example of such a (PHP) script. Note it doesn't take security into account! 
     11                Here is a very basic example of such a (PHP) script. 
    1212 
    13                 <?php 
    14                 if(isset ($GLOBALS["HTTP_RAW_POST_DATA"])) { 
    15                         $im =  $GLOBALS["HTTP_RAW_POST_DATA"]; 
    16                         $rn = rand(); 
    17                         $fp = fopen('snapshots/'.$rn.'.jpg', 'wb'); 
    18                         fwrite($fp, $im); 
    19                         fclose($fp); 
    20                         echo 'http://www.myserver.com/snapshots/'.$rn.'.jpg'; 
    21                 }  else { 
    22                         echo 'result=An error occured.'; 
    23                 } 
    24                 ?>]]> 
    25                  
    26                 Alternatively, the player can send just a position variable to the server. 
    27                 The server then has to take care of rendering the snapshot. 
     13<?php 
     14if(isset ($GLOBALS["HTTP_RAW_POST_DATA"])) { 
     15        $im =  $GLOBALS["HTTP_RAW_POST_DATA"]; 
     16        $rn = rand(); 
     17        $fp = fopen('snapshots/'.$rn.'.jpg', 'wb'); 
     18        fwrite($fp, $im); 
     19        fclose($fp); 
     20        if (exif_imagetype($rn.'.jpg') == IMAGETYPE_JPEG) { 
     21                echo 'http://www.myserver.com/snapshots/'.$rn.'.jpg'; 
     22                exit(); 
     23        } 
     24} 
     25echo "error"; 
     26?>]]> 
    2827        </description> 
    2928        <href>http://developer.longtailvideo.com/trac/browser/plugins/snapshot</href> 
    3029 
    3130        <flashvars> 
    32                 <flashvar> 
    33                         <name>data</name> 
    34                         <default>true</default> 
    35                         <description>If true, the plugin will send raw JPG data to the serverside script. If false, the plugin will do a simple GET ping to the serverside script with the position in seconds as variable. You can use the latter if you want to generate the snapshot serverside.</description> 
    36                 </flashvar> 
    3731                <flashvar> 
    3832                        <name>script</name> 
  • plugins/yousearch/yousearch.xml

    r215 r220  
    1414        <href>http://developer.longtailvideo.com/trac/browser/plugins/yousearch</href> 
    1515 
    16         <flashvars> 
    17                 <flashvar> 
    18                         <name>script</name> 
    19                         <default>http://gdata.youtube.com/feeds/api/videos?vq=QUERY&amp;format=5</default> 
    20                         <description> 
    21                                 Location of the script called when a search is performed. 
    22                                 The 'QUERY' part will be replaced by the actul search query. 
    23                                 Defaults to a search at Youtube.com. 
    24                         </description> 
    25                 </flashvar> 
    26         </flashvars> 
     16        <flashvars /> 
    2717 
    2818</plugin> 
  • testing/index.html

    r218 r220  
    406406                <label>repeat</label> 
    407407                <input type="text" name="repeat" /> 
    408                 <label>resizing</label> 
    409                 <input type="text" name="resizing" /> 
    410408                <label>shuffle</label> 
    411409                <input type="text" name="shuffle" /> 
  • testing/settings.js

    r217 r220  
    232232                        width:500, 
    233233                        plugins:'hd', 
    234                         'hd.file':'../../testing/files/bunny.mp4' 
     234                        'hd.file':'../../testing/files/bunny.m4v' 
    235235                }, 
    236236                'Livestream plugin': { 
     
    243243                        'livestream.streamer':'rtmp://fl9.maelstrom.jet-stream.nl:80/vod/' 
    244244                }, 
    245                 'Metaviewer and revolt plugins': { 
     245                'Metaviewer plugin': { 
    246246                        file:'../../testing/files/bunny.flv', 
    247247                        height:260, 
    248                         width:900, 
     248                        width:800, 
    249249                        repeat:'always', 
    250250                        stretching:'fill', 
    251                         plugins:'revolt,metaviewer', 
    252                         'revolt.gain':2, 
    253                         'revolt.position':'left', 
    254                         'revolt.size':300, 
     251                        plugins:'metaviewer', 
    255252                        'metaviewer.position':'right', 
    256                         'metaviewer.size':300 
     253                        'metaviewer.size':400 
     254                }, 
     255                'Revolt plugin': { 
     256                        file:'files/bunny.mp3', 
     257                        height:260, 
     258                        width:500, 
     259                        repeat:'always', 
     260                        plugins:'revolt', 
     261                        'revolt.gain':2 
    257262                }, 
    258263                'Snapshot plugin': { 
  • trunk/as3/com/jeroenwijering/models/HTTPModel.as

    r213 r220  
    147147        protected function loadHandler():void { 
    148148                var ldd:Number = stream.bytesLoaded; 
    149                 var ttl:Number = stream.bytesTotal + byteoffset; 
    150                 var off:Number = byteoffset; 
     149                var ttl:Number = stream.bytesTotal; 
     150                var pct:Number = timeoffset/(item['duration']+0.001); 
     151                var off:Number = Math.round(ttl*pct/(1-pct)); 
     152                ttl += off; 
    151153                model.sendEvent(ModelEvent.LOADED,{loaded:ldd,total:ttl,offset:off}); 
    152154                if(ldd+off >= ttl && ldd > 0) { 
     
    230232                        model.sendEvent(ModelEvent.TIME,{position:position,duration:item['duration']}); 
    231233                } else if (item['duration'] > 0) { 
    232                         pause(); 
     234                        stream.pause(); 
     235                        clearInterval(interval); 
    233236                        model.sendEvent(ModelEvent.STATE,{newstate:ModelStates.COMPLETED}); 
    234237                } 
     
    254257                                stream.seek(getOffset(position,true)); 
    255258                        } 
    256                         interval = setInterval(positionInterval,100); 
    257                         model.sendEvent(ModelEvent.STATE,{newstate:ModelStates.PLAYING}); 
     259                        play(); 
    258260                } 
    259261        }; 
  • trunk/as3/com/jeroenwijering/models/RTMPModel.as

    r210 r220  
    140140                if(position < item['duration']) { 
    141141                        model.sendEvent(ModelEvent.TIME,{position:position,duration:item['duration']}); 
    142                 } else if (item['duration'] > 0) { 
    143                         pause(); 
     142                } else if (!isNaN(position) && item['duration'] > 0) { 
     143                        stream.pause(); 
     144                        clearInterval(interval); 
     145                        if(started && item['duration'] == 0) { stop(); } 
    144146                        model.sendEvent(ModelEvent.STATE,{newstate:ModelStates.COMPLETED}); 
    145147                } 
     
    151153                position = pos; 
    152154                clearInterval(interval); 
    153                 if(model.config['state'] == ModelStates.PAUSED) { 
     155                if(model.config['state'] != ModelStates.PLAYING) { 
    154156                        stream.resume(); 
    155157                } 
     
    181183                        case 'NetConnection.Connect.Success': 
    182184                                if(evt.info.secureToken != undefined) { 
    183                                         connection.call("secureTokenResponse",null,TEA.decrypt(evt.info.secureToken,model.config['token'])); 
     185                                        connection.call("secureTokenResponse",null, 
     186                                                TEA.decrypt(evt.info.secureToken,model.config['token'])); 
    184187                                } 
    185188                                setStream(); 
     
    199202                                break; 
    200203                        case 'NetConnection.Connect.Rejected': 
    201                                 if(evt.info.ex && evt.info.ex.code == 302) { 
     204                                if(evt.info.ex.code == 302) { 
    202205                                        item['streamer'] = evt.info.ex.redirect; 
    203                                         connection.connect(item['streamer']); 
     206                                        setTimeout(load,100,item); 
     207                                        return; 
    204208                                } 
    205209                                break; 
  • trunk/as3/com/jeroenwijering/models/VideoModel.as

    r210 r220  
    141141                        model.sendEvent(ModelEvent.TIME,{position:position,duration:item['duration']}); 
    142142                } else if (item['duration'] > 0) { 
    143                         pause(); 
     143                        stream.pause(); 
     144                        clearInterval(interval); 
    144145                        model.sendEvent(ModelEvent.STATE,{newstate:ModelStates.COMPLETED}); 
    145146                } 
  • trunk/as3/com/jeroenwijering/player/Controller.as

    r211 r220  
    325325        private function playlistHandler(ply:Array):void { 
    326326                for(var i:Number = ply.length-1; i > -1; i--) { 
    327                         if(!ply[i]['duration']) { ply[i]['duration'] = 0; } 
    328                         if(!ply[i]['start']) { ply[i]['start'] = 0; } 
     327                        if(!ply[i]['duration'] || isNaN(ply[i]['duration'])) { ply[i]['duration'] = 0; } 
     328                        if(!ply[i]['start'] || isNaN(ply[i]['start'])) { ply[i]['start'] = 0; } 
    329329                        if(!ply[i]['streamer'] && config['streamer']) { 
    330330                                ply[i]['streamer'] = config['streamer']; 
  • trunk/as3/com/jeroenwijering/plugins/Controlbar.as

    r210 r220  
    179179                } catch (err:Error) {} 
    180180                try { 
    181                         if(view.playlist && view.playlist[view.config['item']]['link'] && !view.config['dock']) { 
     181                        if(view.playlist && view.playlist[view.config['item']]['link']) { 
    182182                                clip.linkButton.visible = true; 
    183183                        } else {  
  • trunk/as3/com/jeroenwijering/plugins/Dock.as

    r218 r220  
    1919        /** Configuration vars for this plugin. **/ 
    2020        public var config:Object = { 
    21                 align:'right', 
    22                 link:true 
     21                align:'right' 
    2322        }; 
    2423        /** Reference to the skin MVC. **/ 
     
    3231        /** Timeout for hiding the buttons when the video plays. **/ 
    3332        private var timeout:Number; 
    34         /** Linkbutton reference. **/ 
    35         private var link:DockButton; 
    3633 
    3734 
     
    6461                if(view.config['dock']) { 
    6562                        view.addControllerListener(ControllerEvent.RESIZE,resizeHandler); 
    66                         view.addControllerListener(ControllerEvent.ITEM,itemHandler); 
    67                         view.addControllerListener(ControllerEvent.PLAYLIST,itemHandler); 
    6863                        view.addModelListener(ModelEvent.STATE,stateHandler); 
    6964                        clip.stage.addEventListener(MouseEvent.MOUSE_MOVE,moveHandler); 
     
    7469                        setColorTransforms(); 
    7570                } 
    76         }; 
    77  
    78  
    79         /** Let's see if the new item has a link. **/ 
    80         private function itemHandler(evt:ControllerEvent):void { 
    81                 if(link) { 
    82                         removeButton(link); 
    83                 } 
    84                 if(view.playlist[view.config['item']]['link'] && config['link']) { 
    85                         link = addButton(null,'visit link',linkHandler); 
    86                 } 
    87         } 
    88  
    89  
    90         /** Manage clicks on the docks' link button. **/ 
    91         private function linkHandler(evt:MouseEvent):void { 
    92                 view.sendEvent(ViewEvent.LINK,view.config['item']); 
    9371        }; 
    9472 
  • trunk/sdk/plugins/controlling/Controlling.as

    r209 r220  
    2626                button.graphics.beginFill(0x000000,0.5); 
    2727                button.graphics.drawRoundRect(10,10,40,40,5); 
    28                 button.graphics.beginFill(0xFFFFFF,1); 
     28                button.graphics.beginFill(0xFF0000,1); 
    2929                button.graphics.drawCircle(30,30,8); 
    3030                addChild(button); 
  • trunk/sdk/readme.html

    r209 r220  
    4747        <p>Exactly which players, skins, plugins and examples to show can be set in the <a href="files/settings.js">files/settings.js</a> file. It is a javascript dictionary that is easy to understand and change, but be careful to correctly set commas and curly braces!</p> 
    4848 
    49         <p>Next to the location of your plugin SWF file, the testing page also needs an XML file that describes your plugin. It is a simple xml format (<a href="plugins/flashvars.xml">example</a>) that contains an overview and the list of flashvars for your plugin. You also need to have this XML later on for <a href="http://www.longtailvideo.com/addons/submitregister.html">submitting your plugin</a> to LongTail Video.</p> 
     49        <p>Next to the location of your plugin SWF file, the testing page also needs an XML file that describes your plugin. It is a simple xml format (<a href="plugins/flashvars/flashvars.xml">example</a>) that contains an overview and the list of flashvars for your plugin. You can also use this XML later on for <a href="http://www.longtailvideo.com/addons/submitregister.html">submitting your plugin</a> to LongTail Video.</p> 
    5050 
    5151 
     
    5454        <p>The developer Wiki contains a wealth of resources for building plugins, including:</p> 
    5555        <ul> 
    56                 <li>The general <a href="http://developer.longtailvideo.com/trac/wiki/BuildingPlugins">plugin building tutorial</a>.</li> 
    57                 <li>A hands-on tutorial that <a href="http://developer.longtailvideo.com/trac/wiki/YousearchTutorial">Rebuilds the Yousearch plugin</a>.</li> 
    58                 <li>A tutorial about <a href="http://developer.longtailvideo.com/trac/wiki/CrossDomain">Flash security restrictions</a>. Read this if you want to load XML or other data across websites.</li> 
     56                <li>The general <a href="http://developer.longtailvideo.com/trac/wiki/FlashPlugins">player plugin documentation</a>. It's a general overview of how plugins work.</li> 
     57                <li>A tutorial about <a href="http://developer.longtailvideo.com/trac/wiki/FlashSecurity">Flash security restrictions</a>. Read this if you want to load XML or other data across websites.</li> 
     58                <li>A reference of the <a href="http://developer.longtailvideo.com/trac/wiki/FlashApi">API calls</a> plugins can use to interact with the player.</li> 
     59                <li>A reference of all <a href="http://developer.longtailvideo.com/trac/wiki/FlashEvents">events the player fires</a>. The <i>View</i> events are the ones your plugin can trigger.</li> 
    5960        </ul> 
    60         <ul> 
    61                 <li>A reference of the <a href="http://developer.longtailvideo.com/trac/wiki/FlashAPI">API calls</a> plugins can use to interact with the player.</li> 
    62                 <li>A reference of all <a href="http://developer.longtailvideo.com/trac/wiki/FlashEvents">events the player fires</a>. The <i>View</i> events are the ones your plugin can fire too.</li> 
    63                 <li>A reference of the  <a href="http://developer.longtailvideo.com/trac/wiki/FlashOverview">architecture of the JW Player</a> (including the plugin loading and positioning/resizing).</li> 
    64         </ul> 
    65         <p>You can also directly download the source code of a string of plugins <a href="http://developer.longtailvideo.com/trac/browser/plugins">from the developer site</a>. Feel free to copy/paste code and/or create your own branch of any of these plugins!</p> 
     61        <p>You can also find <a href="http://developer.longtailvideo.com/trac/#Plugins">info and source code</a> on a string of plugins we built. Feel free to (re)use this code or create your own branch of any of these plugins!</p> 
    6662 
    6763 
    6864 
    6965        <h3>Submit your plugin</h3> 
    70         <p>If you're happy with the way your plugin works, you can <a href="http://www.longtailvideo.com/addons/submitregister.html">submit it to LongTail Video</a>. We'll do a quick sanity check of your plugin and then list it in <a href="http://www.longtailvideo.com/addons/">our addons section</a>. You can also ask for donations or sell licenses of your plugin through our site to make money. For more info about that, please <a href="http://www.longtailvideo.com/support/contact-us">contact us</a>.</p> 
     66        <p>If you're happy with the way your plugin works, you can <a href="http://www.longtailvideo.com/addons/submitregister.html">submit it to LongTail Video</a>. We'll do a quick sanity check of your plugin and then list it in <a href="http://www.longtailvideo.com/addons/">our addons section</a>. You can also ask for donations of your plugin through our site to make some money. For more info about that, please <a href="http://www.longtailvideo.com/support/contact-us">contact us</a>.</p> 
    7167 
    7268</body>