Skip to content

Commit

Permalink
Merge pull request #6 from red5pro/develop
Browse files Browse the repository at this point in the history
JS Callouts
  • Loading branch information
bustardcelly committed Jan 21, 2016
2 parents ea2d57c + 9b5242a commit f2aa720
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
16 changes: 16 additions & 0 deletions flash-clients/Broadcaster/html-template/index.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,22 @@

<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">

var broadcast = {
start : function(info){
console.log("start "+ info.host+"/"+info.streamName);
},

stop : function(){
console.log("broadcast stop");
},

onStatus : function (status){
console.log("onStatus "+ info.host+"/"+info.streamName+" "+info.status);
}
};


// For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection.
var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
// To use express install, set to playerProductInstall.swf, otherwise the empty string.
Expand Down
26 changes: 24 additions & 2 deletions flash-clients/Broadcaster/src/Broadcaster.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
horizontalAlign="center"
paddingTop="20" paddingLeft="10"
paddingBottom="20" paddingRight="10">

<!-- Video Container -->
<s:Group width="320" height="240">
<s:Rect width="100%" height="100%">
Expand All @@ -187,7 +187,7 @@
enabled="false"
click="toggleBroadcast();"
/>

</s:VGroup>
</s:Group>

Expand Down Expand Up @@ -391,6 +391,13 @@
netConnection=null;
startStreamButton.label = START_BROADCAST;
removeEventListener(Event.ENTER_FRAME, onFrame, false);
if(ExternalInterface.available) {
try{
ExternalInterface.call("broadcast.stop");
}catch(e:Error){
}
}
}
Expand Down Expand Up @@ -424,6 +431,13 @@
timeField.text = Number(0).toString();
addEventListener(Event.ENTER_FRAME, onFrame, false, 0, true);
log("Streaming to: " + rtmpEndpoint + "...");
if(ExternalInterface.available) {
try{
ExternalInterface.call("broadcast.start",{host:rtmpEndpoint,streamName:streamName});
}catch(e:Error){
}
}
}
protected function onFrame(event:Event):void {
Expand All @@ -436,6 +450,14 @@
protected function onStatus(event:NetStatusEvent):void {
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 });
}catch(e:Error){
}
}
// Determine event code reference.
switch(event.info.code) {
Expand Down

0 comments on commit f2aa720

Please sign in to comment.