Commit 487701ae authored by Anssi Piirainen's avatar Anssi Piirainen
Browse files

Merge Dan's branch.

parents 7cf2bcbe 4566b615
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<script type="text/javascript" src="flowplayer-3.0.5.min.js"></script>-->
<script src="../flowplayer-3.2.6.min.js"></script>
<script src="flowplayer-3.2.12.js"></script>
<!-- page title -->
......@@ -15,10 +15,12 @@
style="display:block;width:440px;height:247px"
id="player">
</a>
<script>
flowplayer("player", "../build/flowplayer-3.2.8-dev.swf",
flowplayer("player", "../../../flash-build/build/flowplayer.swf",
{
log: { level: 'debug', filter: 'org.flowplayer.bwcheck.*' },
log: { level: 'debug', filter: 'org.flowplayer.cluster.*, org.flowplayer.f4m.*, org.flowplayer.httpstreaming.*, org.flowplayer.bwcheck.*' },
onStart: function() {
console.log("onStart");
},
......@@ -36,10 +38,22 @@
},
clip: {
//url: "http://itv08.digizuite.dk/tv2b/ngrp:ch1_all/manifest.f4m",
//url: "http://localhost:1935/live/livestream/manifest.f4m",
url: "sample1.f4m",
//url: "http://localhost:1935/dvr/livestream/manifest.f4m?DVR",
//urlResolvers: ['f4m'],
urlResolvers: ['f4m','bwcheck'],
provider: 'httpstreaming',
baseUrl: "http://httpstreaming.electroteque.org/videos/vod/"
startLivePosition: true,
baseUrl: 'http://stream.flowplayer.org/httpstreaming/',
bitrates: [
{ bitrate: 259},
{ bitrate: 405, isDefault: true},
{ bitrate: 894},
{ bitrate: 3064}
]
},
plugins: {
......@@ -57,10 +71,13 @@
url: 'flowplayer.httpstreaming.swf'
},
bwcheck: {
url: 'flowplayer.bwcheck.swf',
netConnectionUrl: 'http://flowplayer.electroteque.org/swf/flowplayer-bwcheck.swf',
url: 'flowplayer.bwcheck-httpstreaming.swf',
//netConnectionUrl: 'http://flowplayer.electroteque.org/swf/flowplayer-bwcheck.swf',
dynamicBuffer: true,
netConnectionUrl: "http://releases.flowplayer.org/swf/flowplayer-3.2.16.swf",
bitrateProfileName: 'HTTPBitrateProfile',
dynamic: false,
dynamic: true,
checkOnStart: true,
//onStreamSwitch: switchStreamInfo,
//onStreamSwitchBegin: switchStreamInfoBegin,
// this method is called when the bandwidth check is done
......@@ -71,13 +88,16 @@
onStreamSwitchBegin: function (newItem, currentItem) {
console.log("Will switch to: " + newItem.streamName +
" from " + currentItem.streamName);
// $f().getPlugin('content').setHtml("Will switch to: " + newItem.streamName +
// " from " + currentItem.streamName);
$f("player").getPlugin('content').setHtml("Will switch to: " + newItem.bitrate +
" from " + currentItem.bitrate);
},
onStreamSwitch: function (newItem) {
console.log('content').setHtml("Switched to: " + newItem.streamName);
// $f().getPlugin('content').setHtml("Switched to: " + newItem.streamName);
}
// console.log('content').setHtml("Switched to: " + newItem.streamName);
$f("player").getPlugin('content').setHtml("Switched to: " + newItem.bitrate);
},
onBwDone: function(mappedBitrate) {
$f("player").getPlugin('content').setHtml("Mapped to: " + mappedBitrate.bitrate);
}
},
content: {
url: 'flowplayer.content.swf',
......
......@@ -29,10 +29,9 @@
$.extend(opts, options);
var wrap = container;
var wrap = $(container);
// use either the element with templateId or the contents of wrap
var template = null;
var template = opts.templateId ? $('<div>').append($(opts.templateId).clone()).remove().html() : wrap.html();
var plugin = self.getPlugin(opts.pluginName) || null;
......@@ -100,11 +99,6 @@
bitrateItems = self.getClip().bitrateItems ? self.getClip().bitrateItems : self.getClip().bitrates;
if (bitrateItems.length > 0) {
wrap = $(wrap);
//fix for #322 containers only obtainable at this point
template = opts.templateId ? $('<div>').append($(opts.templateId).clone()).remove().html() : wrap.html();
wrap.empty();
buildBitrateList();
}
......
......@@ -16,7 +16,7 @@ package org.flowplayer.net {
public class BitrateResource {
protected var log:Log = new Log(this);
protected function sort(bitrates:Vector.<BitrateItem>):Vector.<BitrateItem> {
/*protected function sort(bitrates:Vector.<BitrateItem>):Vector.<BitrateItem> {
var sorter:Function = function (a:BitrateItem, b:BitrateItem):Number {
// increasing bitrate order
if (a.bitrate == b.bitrate) {
......@@ -35,7 +35,7 @@ package org.flowplayer.net {
return -1;
};
return bitrates.concat().sort(sorter);
}
} */
public function addBitratesToClip(clip:Clip):Vector.<BitrateItem> {
log.debug("addBitratesToClip()");
......
......@@ -36,7 +36,8 @@ package org.flowplayer.ui.controllers {
override protected function createWidget():void {
_widget = new GenericTooltipButton(new faceClass(), _config as TooltipButtonConfig, _player.animationEngine);
//#443 set accessibility options for button widget
setAccessible(_widget, name);
setAccessible(_widget, (_config as TooltipButtonConfig).tooltipLabel ? (_config as TooltipButtonConfig).tooltipLabel : name);
}
protected function addWidgetListeners():void {
......
......@@ -9,17 +9,14 @@
* Additional Term, see http://flowplayer.org/license_gpl.html
*/
package org.flowplayer.ui.dock {
import org.flowplayer.ui.*;
import org.flowplayer.ui.AutoHideConfig;
import org.flowplayer.model.DisplayPluginModel;
import org.flowplayer.model.DisplayPluginModelImpl;
import org.flowplayer.model.DisplayProperties;
import org.flowplayer.model.DisplayPropertiesImpl;
import org.flowplayer.ui.buttons.ButtonConfig;
import org.flowplayer.util.PropertyBinder;
import org.flowplayer.view.FlowStyleSheet;
import spark.components.Button;
public class DockConfig {
private var _model:DisplayPluginModel;
private var _autoHide:AutoHideConfig;
......
......@@ -34,4 +34,64 @@
<target name="demo" >
<example player-swf="flowplayer.swf" main-swf="${plugin-binary-versioned}" />
</target>
<macrodef name="mxmlc.compile">
<attribute name="src" default="${src-as}" />
<attribute name="plugin-main-class" default="${plugin-main-class}" />
<attribute name="out" default="${plugin-binary}" />
<attribute name="libs" default="" />
<sequential>
<condition property="libs" value="" else="-include-libraries @{libs}">
<equals arg1="@{libs}" arg2="" />
</condition>
<condition property="pluginruntimelibs1" value="-runtime-shared-library-path+=${plugin-runtime-lib-swc1},library.swf" else="">
<isset property="plugin-runtime-lib-swc1" />
</condition>
<condition property="pluginruntimelibs2" value="-runtime-shared-library-path+=${plugin-runtime-lib-swc2},library.swf" else="">
<isset property="plugin-runtime-lib-swc2" />
</condition>
<condition property="pluginruntimelibs3" value="-runtime-shared-library-path+=${plugin-runtime-lib-swc3},library.swf" else="">
<isset property="plugin-runtime-lib-swc3" />
</condition>
<condition property="mxmlc-library-path" value="${library-path}" else="">
<isset property="library-path" />
</condition>
<condition property="mxmlc-define" value="-define=${compiler-define}" else="">
<isset property="compiler-define" />
</condition>
<condition property="mxmlc-defines" value="${compiler-defines}" else="">
<isset property="compiler-defines" />
</condition>
<condition property="mxmlc-sources" value="${extra-sources}" else="">
<isset property="extra-sources" />
</condition>
<echo message="compiling with ${mxmlc-library-path}" />
<echo message="compiling with ${mxmlc-define} ${mxmlc-defines}" />
<exec executable="${mxmlc_bin}" failonerror="true">
<arg line="-source-path @{src} ${mxmlc-library-path} ${mxmlc-sources}" />
<arg line="${mxmlc-define}" />
<arg line="${mxmlc-defines}" />
<arg line="${libs}" />
<arg line="-library-path ${flex-libs-path} ${mxmlc-library-path}" />
<arg line="-runtime-shared-library-path=${flowplayer_lib},library.swf" />
<arg line="${pluginruntimelibs1}" />
<arg line="${pluginruntimelibs2}" />
<arg line="${pluginruntimelibs3}" />
<arg line="-static-link-runtime-shared-libraries=false"/>
<arg line="-generate-frame-loader=false"/>
<arg line="-default-frame-rate=${framerate}" />
<arg line="-default-background-color=${bgcolor}" />
<arg line="-strict=true" />
<arg line="-keep-as3-metadata=Value,External" />
<!-- Load external osmf library from httpstreaming except NetClient -->
<arg line="-load-externs lib/externs.xml" />
<arg line="'@{src}/@{plugin-main-class}'" />
<arg line="-output '${build-dir}/@{out}'" />
<arg line="-incremental=false"/>
</exec>
</sequential>
</macrodef>
</project>
\ No newline at end of file
This diff is collapsed.
......@@ -8,28 +8,27 @@
* http://www.opensource.org/licenses/mit-license.php
*/
package org.flowplayer.bwcheck.detect {
import flash.events.EventDispatcher;
import flash.events.NetStatusEvent;
import flash.net.NetConnection;
import flash.utils.setTimeout;
import org.flowplayer.bwcheck.config.Config;
import org.flowplayer.bwcheck.net.NullNetConnectionClient;
import org.flowplayer.cluster.RTMPCluster;
import org.flowplayer.model.ClipEvent;
import org.flowplayer.model.Playlist;
import org.flowplayer.model.PluginEventType;
import org.flowplayer.model.PluginModel;
import org.flowplayer.util.Log;
import org.flowplayer.view.Flowplayer;
/**
* @author danielr
*/
public class BandwidthDetector extends EventDispatcher {
package org.flowplayer.bwcheck.detect {
import flash.events.EventDispatcher;
import flash.events.NetStatusEvent;
import flash.net.NetConnection;
import flash.utils.setTimeout;
import org.flowplayer.bwcheck.config.Config;
import org.flowplayer.bwcheck.net.NullNetConnectionClient;
import org.flowplayer.cluster.RTMPCluster;
import org.flowplayer.model.ClipEvent;
import org.flowplayer.model.Playlist;
import org.flowplayer.model.PluginEventType;
import org.flowplayer.model.PluginModel;
import org.flowplayer.util.Log;
/**
* @author danielr
*/
public class BandwidthDetector extends EventDispatcher {
private var log:Log = new Log(this);
// --------- These references are needed here, so that the classes get compiled in!
......
......@@ -8,15 +8,11 @@
*/
package org.flowplayer.bwcheck.detect {
import org.flowplayer.bwcheck.detect.*;
import org.flowplayer.bwcheck.detect.AbstractDetectionStrategy;
import flash.utils.setTimeout;
/**
* @author danielr
*/
public class BandwidthDetectorFms extends AbstractDetectionStrategy {
/**
* @author danielr
*/
public class BandwidthDetectorFms extends AbstractDetectionStrategy {
private var _host:String;
......
......@@ -13,7 +13,6 @@ package org.flowplayer.bwcheck.detect {
import flash.events.ProgressEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.net.URLRequestHeader;
import flash.net.URLRequestMethod;
import flash.utils.getTimer;
......@@ -28,7 +27,6 @@ package org.flowplayer.bwcheck.detect {
private var _bandwidth:Number;
private var _downloadTime:Number;
public var maximumBytes:uint;
private var _nocache:URLRequestHeader;
private var _referenceFileUrl:String;
public function BandwidthDetectorHttp() {
......
......@@ -8,7 +8,6 @@
*/
package org.flowplayer.bwcheck.detect {
import org.flowplayer.bwcheck.detect.AbstractDetectionStrategy;
/**
* @author danielr
......
......@@ -8,9 +8,6 @@
*/
package org.flowplayer.bwcheck.detect {
import flash.net.Responder;
import org.flowplayer.bwcheck.detect.AbstractDetectionStrategy;
/**
* @author danielr
......
......@@ -8,15 +8,11 @@
*/
package org.flowplayer.bwcheck.detect {
import flash.net.Responder;
import org.flowplayer.bwcheck.detect.AbstractDetectionStrategy;
/**
* @author danielr
*/
public class BandwidthDetectorWowza extends AbstractDetectionStrategy {
private var info:Object = new Object();
public function onBwCheck(obj:Object):Boolean {
return onBWCheck(obj);
......
/*
* This file is part of Flowplayer, http://flowplayer.org
*
* By: Daniel Rossi, <electroteque@gmail.com>, Anssi Piirainen Flowplayer Oy
* Copyright (c) 2008-2011 Flowplayer Oy *
* Released under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*/
package org.flowplayer.bwcheck.detect {
import flash.events.Event;
public class DynamicStreamEvent extends Event {
public static const SWITCH_STREAM:String = "switch_stream";
private var _info:Object;
public function DynamicStreamEvent(eventName:String) {
super(eventName);
}
public function set info(obj:Object):void {
_info = obj;
}
public function get info():Object {
return _info;
}
}
}
\ No newline at end of file
......@@ -16,9 +16,6 @@ package org.flowplayer.bwcheck.net {
import org.flowplayer.view.Flowplayer;
import org.flowplayer.controller.ClipURLResolver;
import org.flowplayer.util.Log;
//import org.flowplayer.util.PropertyBinder;
import org.flowplayer.model.DisplayProperties;
......@@ -27,20 +24,16 @@ package org.flowplayer.bwcheck.net {
import org.flowplayer.bwcheck.config.Config;
import org.osmf.net.DynamicStreamingItem;
//import org.osmf.net.NetStreamMetricsBase;
import org.osmf.net.NetStreamSwitchManagerBase;
CONFIG::enableRtmpMetrics {
import org.osmf.net.NetStreamSwitchManager;
}
public class BWStreamSelectionManager extends StreamSelectionManager {
public class BWStreamSelectionManager extends StreamSelectionManager {
private var _config:Config;
private static var bwSelectLog:Log = new Log("org.flowplayer.bwcheck.net::BWStreamSelectionManager");
private var dynamicStreamingItems:Vector.<DynamicStreamingItem>;
//private var _netStreamMetrics:NetStreamMetricsBase;
private var _netStreamSwitchManager:NetStreamSwitchManagerBase;
public function BWStreamSelectionManager(bitrateResource:BitrateResource, player:Flowplayer, resolver:ClipURLResolver, config:Config) {
......
......@@ -9,16 +9,13 @@
*/
package org.flowplayer.bwcheck.net {
import org.flowplayer.bwcheck.detect.*;
import org.flowplayer.bwcheck.config.Config;
import org.flowplayer.util.Log;
import org.flowplayer.view.Flowplayer;
import org.flowplayer.net.BitrateItem;
import org.flowplayer.net.IStreamSelectionManager;
import org.osmf.net.DynamicStreamingItem;
import org.osmf.net.SwitchingRuleBase;
import org.osmf.net.rtmpstreaming.RTMPNetStreamMetrics;
import org.osmf.net.NetStreamMetricsBase;
......@@ -37,7 +34,6 @@ package org.flowplayer.bwcheck.net {
}
override public function getNewIndex():int {
var screenWidth:Number = _player.screen.getDisplayObject().width;
for (var i:Number = _bitrates.length - 1; i >= 0; i--) {
var item:BitrateItem = _bitrates[i];
......
Version history:
3.2.9
-----
- #99 cleanup domain parsing, use native function instead of mx classes.
- #101 fixes for handling origin server redirections.
3.2.4
-----
- #601 dispatch resolver failure correctly.
......
......@@ -10,260 +10,273 @@
package org.flowplayer.cluster
{
import flash.events.TimerEvent;
import flash.net.SharedObject;
import flash.utils.Timer;
import mx.utils.URLUtil;
import org.flowplayer.flow_internal;
import org.flowplayer.model.ClipEvent;
import org.flowplayer.model.PluginEventDispatcher;
import org.flowplayer.model.PluginEventType;
import org.flowplayer.model.PluginModel;
import org.flowplayer.model.PluginModelImpl;
import org.flowplayer.util.Log;
use namespace flow_internal;
public class RTMPCluster {
protected var _hosts:Array;
protected var _timer:Timer;
protected var _hostIndex:int = 0;
protected var _hostCount:int = 0;
protected var _connectCount:int = 0;
protected var _reConnectCount:int = 0;
protected var _connectTimeout:int = 2000;
protected var _loadBalanceServers:Boolean = false;
protected var _liveHosts:Array;
protected var _liveRandomServers:Array = [];
private var _startAfterConnect:Boolean;
protected var _failureExpiry:int = 0;
import flash.events.TimerEvent;
import flash.net.SharedObject;
import flash.utils.Timer;
//import mx.utils.URLUtil;
import org.flowplayer.flow_internal;
//import org.flowplayer.model.PluginModelImpl;
import org.flowplayer.util.Log;
import org.flowplayer.util.URLUtil;
use namespace flow_internal;
public class RTMPCluster {
protected var _hosts:Array;
protected var _timer:Timer;
protected var _hostIndex:int = 0;
//protected var _hostCount:int = 0;
protected var _connectCount:int = 0;
protected var _reConnectCount:int = 0;
protected var _connectTimeout:int = 2000;
//protected var _loadBalanceServers:Boolean = false;
protected var _liveHosts:Array;
//protected var _liveRandomServers:Array = [];
//private var _startAfterConnect:Boolean;
protected var _failureExpiry:int = 0;
protected var _reconnectFailureExpiry:int = 0;
private var _config:*;
private var _dispatcher:PluginModelImpl;
private var log:Log = new Log(this);
private var _reconnectListener:Function;
private var _failureListener:Function;
private var _currentHost:Object;
public function RTMPCluster(config:*)
{
_config = config;
// there can be several hosts, or we are just using one single netConnectionUrl
initHosts(_config.hosts, config.netConnectionUrl);
_connectCount = config.connectCount;
_connectTimeout = config.connectTimeout;
_failureExpiry = config.failureExpiry;
_currentHost = _hosts ? _hosts[0] : null;
}
private function initHosts(hosts:Array, fallback:String):void {
log.debug("initHosts()");
var myHosts:Array = [];
if (! hosts || hosts.length == 0) {
if (! fallback) {
throw new Error("A hosts array or a netConnectionUrl must be configured");
}
myHosts.push({ 'host': fallback});
} else {
for (var i:int = 0; i < hosts.length; i++) {
myHosts.push(hosts[i] is String ? { 'host': hosts[i] } : hosts[i]);
private var _config:*;
//private var _dispatcher:PluginModelImpl;
private var log:Log = new Log(this);
private var _reconnectListener:Function;
private var _failureListener:Function;
private var _currentHost:Object;
public function RTMPCluster(config:*)
{
_config = config;
// there can be several hosts, or we are just using one single netConnectionUrl
initHosts(_config.hosts, config.netConnectionUrl);