Changeset 1247


Ignore:
Timestamp:
08/29/10 08:32:58 (3 years ago)
Author:
jeroen
Message:

merged dynamic loadbalanced rtmp branch; added support for bitrate switching without width

Files:
1 deleted
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • testing/files/dynamic.smil

    r1045 r1247  
    11<smil> 
    22        <head> 
    3                 <meta base="rtmpt://fms.12E5.edgecastcdn.net/0012E5"/> 
     3                <meta base="rtmp://fms.12E5.edgecastcdn.net/0012E5"/> 
    44        </head> 
    55        <body> 
    66                <switch> 
    7                         <video src="videos/8Juv1MVa-67727.mp4" width="1080" system-bitrate="1600000"/> 
    8                         <video src="videos/8Juv1MVa-485.mp4" width="720" system-bitrate="1200000"/> 
    9                         <video src="videos/8Juv1MVa-484.mp4" width="480" system-bitrate="800000"/> 
    10                         <video src="videos/8Juv1MVa-483.mp4" width="320" system-bitrate="400000"/> 
     7                        <video src="videos/8Juv1MVa-67727.mp4" system-bitrate="1600000"/> 
     8                        <video src="videos/8Juv1MVa-485.mp4" system-bitrate="1200000"/> 
     9                        <video src="videos/8Juv1MVa-484.mp4" system-bitrate="800000"/> 
     10                        <video src="videos/8Juv1MVa-483.mp4" system-bitrate="400000"/> 
    1111                </switch> 
    1212    </body>  
  • testing/settings.js

    r1240 r1247  
    137137                        height:240, 
    138138                        width:500, 
     139                        bufferlength:5, 
    139140                        plugins:'qualitymonitor' 
    140141                }, 
     
    144145                        height:240, 
    145146                        width:500, 
     147                        bufferlength:5, 
    146148                        'rtmp.loadbalance':true 
     149                }, 
     150                'RTMP loadbalanced dynamic stream': { 
     151                        file:'files/dynamic.smil', 
     152                        provider:'rtmp', 
     153                        height:240, 
     154                        width:500, 
     155                        'rtmp.loadbalance':true, 
     156                        plugins:'qualitymonitor' 
    147157                }, 
    148158                'RTMP live stream (not always on)': { 
  • trunk/fl5/src/com/longtailvideo/jwplayer/media/RTMPMediaProvider.as

    r1240 r1247  
    1010    import com.longtailvideo.jwplayer.model.PlaylistItem; 
    1111    import com.longtailvideo.jwplayer.model.PlaylistItemLevel; 
     12        import com.longtailvideo.jwplayer.parsers.LoadbalanceParser; 
    1213    import com.longtailvideo.jwplayer.player.PlayerState; 
    1314    import com.longtailvideo.jwplayer.utils.AssetLoader; 
     
    7374                /** Whether we should pause the stream when we first connect to it **/ 
    7475                private var     _lockOnStream:Boolean = false; 
     76                /** Do we need to request loadbalance SMILs on switch. **/ 
     77                private var _loadbalanceOnSwitch = true; 
    7578 
    7679 
     
    106109            var mjr:Number = Number(str.split(',')[0]); 
    107110            var mnr:Number = Number(str.split(',')[1]); 
    108             if (!getConfigProperty('loadbalance') && clt > 9 && (mjr > 3 || (mjr == 3 && mnr > 4))) { 
     111            if (!_loadbalanceOnSwitch && clt > 9 && (mjr > 3 || (mjr == 3 && mnr > 4))) { 
    109112                _dynamic = true; 
    110113            } else { 
     
    271274                        } 
    272275                } 
    273                  
    274         /** Get the streamer / file from the loadbalancing XML. **/ 
    275         private function loaderHandler(evt:Event):void { 
    276             var xml:XML = XML((evt.target as AssetLoader).loadedObject); 
    277                         var fileLocation:String = xml.body.video.@src.toString(); 
     276 
     277 
     278                /** Get one or more levels from the loadbalancing XML. **/ 
     279                private function loaderHandler(evt:Event):void { 
     280                        var arr:Array = LoadbalanceParser.parse((evt.target as AssetLoader).loadedObject); 
    278281                        var smilLocation:String = _xmlLoaders[evt.target]; 
    279282                        delete _xmlLoaders[evt.target]; 
    280                         if (item.levels.length > 0) { 
    281                                 var level:PlaylistItemLevel = item.levels[(item.smil as Array).indexOf(smilLocation)] as PlaylistItemLevel;  
    282                                 level.streamer = xml.head.meta.@base.toString(); 
    283                                 level.file = fileLocation; 
     283                        if(arr.length > 1) {  
     284                                for(var i=0; i<arr.length; i++) { item.addLevel(arr[i]); } 
     285                                item.setLevel(item.getLevel(config.bandwidth, config.width)); 
     286                                _loadbalanceOnSwitch = false 
     287                        } else if (item.levels.length > 0) { 
     288                                var level:PlaylistItemLevel = item.levels[(item.smil as Array).indexOf(smilLocation)] as PlaylistItemLevel; 
     289                                level.streamer = arr[0].streamer; 
     290                                level.file = arr[0].file; 
    284291                        } else { 
    285                                 item.streamer = xml.head.meta.@base.toString(); 
    286                         item.file = fileLocation; 
     292                                item.streamer = arr[0].streamer;; 
     293                                item.file = arr[0].file; 
    287294                        } 
    288295                        finishLoad(); 
    289         } 
     296                }; 
     297 
    290298 
    291299        /** Get metadata information from netstream class. **/ 
     
    425433                        if (item.levels.length > 0 && item.getLevel(config.bandwidth, config.width) != item.currentLevel) { 
    426434                item.setLevel(item.getLevel(config.bandwidth, config.width)); 
    427                 if (getConfigProperty('loadbalance')) { 
     435                if (_loadbalanceOnSwitch) { 
    428436                    item.start = pos; 
    429437                    load(item); 
  • trunk/fl5/src/com/longtailvideo/jwplayer/model/PlaylistItem.as

    r1243 r1247  
    3232                                        var levels:Array = obj[itm] as Array; 
    3333                                        for each (var level:Object in levels) { 
    34                                                 if (level['file'] && level['bitrate'] && level['width']) { 
    35                                                         addLevel(new PlaylistItemLevel(level['file'], level['bitrate'], level['width'], level['streamer'])); 
     34                                                if (level['file'] && (level['bitrate'] || level['width'])) { 
     35                                                        addLevel( 
     36                                                                new PlaylistItemLevel(level['file'],  
     37                                                                        Number(level['bitrate']),  
     38                                                                        Number(level['width']),  
     39                                                                        level['streamer'])); 
    3640                                                } 
    3741                                        } 
Note: See TracChangeset for help on using the changeset viewer.