Skip to content

Commit

Permalink
Merge pull request #17 from red5pro/develop
Browse files Browse the repository at this point in the history
Broadcaster changes
  • Loading branch information
bustardcelly authored Sep 22, 2016
2 parents 3c83cbb + f265a33 commit 008b9aa
Showing 1 changed file with 46 additions and 7 deletions.
53 changes: 46 additions & 7 deletions flash-clients/Broadcaster/src/Broadcaster.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,30 @@
</s:VGroup>
</s:Group>

<s:Group width="100%">
<s:Rect width="100%" height="100%">
<s:fill>
<s:SolidColor color="#e3e3e3" />
</s:fill>
</s:Rect>
<s:VGroup width="100%"
paddingTop="10" paddingLeft="10"
paddingBottom="10" paddingRight="10">

<s:Label width="100%"
styleName="header"
text="Enable Recording of the Stream (for VOD)?"
/>
<!-- Upstream Buffer -->
<s:CheckBox id="recordCheck"
width="100%"
label="Enable Recording"
enabled="false"
selected="false"
/>
</s:VGroup>
</s:Group>

<s:Group width="100%">
<s:Rect width="100%" height="100%">
<s:fill>
Expand Down Expand Up @@ -221,7 +245,6 @@

<fx:Script>
<![CDATA[
import flash.utils.setTimeout;
import mx.binding.utils.BindingUtils;
import mx.controls.Alert;
Expand All @@ -235,10 +258,13 @@
private var microphone:Microphone;
private var streamName:String;
private var context:String = "live";
private var streamHost:String = "localhost";
private var streamType:String = "live";
private var streamType:String = STREAM_TYPE_LIVE;
private static const STREAM_TYPE:Array = ["live", "record"];
private static const STREAM_TYPE_LIVE:String = "live";
private static const STREAM_TYPE_RECORD:String = "record";
private static const STREAM_TYPE:Array = [STREAM_TYPE_LIVE, STREAM_TYPE_RECORD];
private var quality:String = RESOLUTION_MID;
private var useHigherQuality:Boolean = false;
Expand Down Expand Up @@ -267,6 +293,10 @@
streamHost = loaderInfo.parameters.host;
}
if (loaderInfo.parameters.context) {
context = loaderInfo.parameters.context;
}
if (loaderInfo.parameters.streamType) {
var st:String = loaderInfo.parameters.streamType;
if (STREAM_TYPE.indexOf(st) > -1) {
Expand All @@ -277,7 +307,11 @@
// Enable input fields as we have basic criteria
streamNameField.enabled = true;
resolutionGroup.enabled = true;
recordCheck.enabled = true;
bufferCheck.enabled = true;
recordCheck.selected = (streamType == STREAM_TYPE_RECORD);
// Default AMF encoding.
NetConnection.defaultObjectEncoding = ObjectEncoding.AMF0;
Expand Down Expand Up @@ -434,7 +468,7 @@
netConnection.client = this;
netConnection.addEventListener(NetStatusEvent.NET_STATUS, onStatus, false, 0, true);
// 'live' is our endpoint from the Red5 Pro Server webapps.
rtmpEndpoint = "rtmp://" + streamHost + "/live";
rtmpEndpoint = "rtmp://" + this.streamHost + "/" + this.context;
netConnection.connect(rtmpEndpoint);
startStreamButton.label = STOP_BROADCAST;
Expand Down Expand Up @@ -462,8 +496,8 @@
log("" + event.info.code);
if(ExternalInterface.available) {
try{
var rtmpEndpoint:String = "rtmp://" + streamHost + "/live";
ExternalInterface.call("broadcast.onStatus",{host:rtmpEndpoint,streamName:streamName, status:"" + event.info.code });
var rtmpEndpoint:String = "rtmp://" + this.streamHost + "/" + this.context;
ExternalInterface.call("broadcast.onStatus",{host: rtmpEndpoint, streamName: this.streamName, status: "" + event.info.code});
}catch(e:Error){
}
Expand All @@ -486,6 +520,10 @@
netStream.attachCamera(camera);
netStream.addEventListener(NetStatusEvent.NET_STATUS, onStatus, false);
if(recordCheck.selected) {
this.streamType = STREAM_TYPE_RECORD;
}
if(quality == RESOLUTION_LOW) {
h264settings = setUpLowQualityBroadcast();
}
Expand All @@ -506,7 +544,7 @@
netStream.videoStreamSettings = h264settings;
netStream.attachAudio(microphone);
netStream.publish(streamName, streamType);
log("Publishing as stream name '" + streamName + "'...");
log("Publishing as stream name '" + this.streamName + "'...");
break;
Expand Down Expand Up @@ -536,6 +574,7 @@
if(bufferCheck.selected) {
netStream.bufferTime = 1;
}
microphone.encodeQuality = 4;
return h264settings;
Expand Down

0 comments on commit 008b9aa

Please sign in to comment.