Skip to content

Commit

Permalink
Merge branch 'wcs_api' of github.com:flashphoner/flashphoner_client i…
Browse files Browse the repository at this point in the history
…nto wcs_api
  • Loading branch information
flashphoner committed Jul 21, 2016
2 parents 3a6ed5e + eee56e8 commit feaf08f
Show file tree
Hide file tree
Showing 6 changed files with 349 additions and 417 deletions.
36 changes: 36 additions & 0 deletions client/src/Flashphoner.js
Expand Up @@ -27,6 +27,7 @@ function Flashphoner() {
this.messages = {};
this.isOpened = false;
this.listeners = {};
this.roomListeners = {};
this.version = undefined;
this.mediaProviders = new DataMap();
this.intervalId = -1;
Expand Down Expand Up @@ -533,6 +534,12 @@ Flashphoner.prototype = {
me.invokeListener(WCSEvent.DataStatusEvent, [
status
]);
},

notifyRoomStatusEvent: function (roomStatusEventListener) {
me.invokeRoomStatusEventListener(roomStatusEventListener.room, [
roomStatusEventListener
]);
}
};
},
Expand Down Expand Up @@ -1211,6 +1218,27 @@ Flashphoner.prototype = {
this.webSocket.send("pauseStream", stream);
},

subscribeRoom:function (roomName, roomEventListener, thisArg) {
this.roomListeners[roomName] = {func: roomEventListener, thisArg: thisArg};
this.webSocket.send("subscribeRoom", {name:roomName});
},

sendRoomData:function (roomName, data) {
this.webSocket.send("sendRoomData", {name:roomName, data:data});
},

invokeRoomStatusEventListener: function (roomName, argsArray) {
var listener = this.roomListeners[roomName];
if (listener) {
listener.func.apply(listener.thisArg ? listener.thisArg : window, argsArray);
}
},

unsubscribeRoom: function (roomName) {
delete this.roomListeners[roomName];
this.webSocket.send("unsubscribeRoom", {name:roomName});
},

releaseMediaManagerStream: function (stream) {
var me = this;
if (MediaProvider.WebRTC == stream.mediaProvider && me.webRtcMediaManager) {
Expand Down Expand Up @@ -2417,6 +2445,14 @@ var Connection = function () {
this.height = "";
};

var RoomStatusEvent = function() {
this.room = null;
this.status = null;
this.login = null;
this.streamName = null;
this.time = null;
};

var ConnectionStatus = function () {
};
ConnectionStatus.Pending = "PENDING";
Expand Down
32 changes: 0 additions & 32 deletions client/src/examples/demo/video-chat/call-controls.html

This file was deleted.

Expand Up @@ -7,11 +7,11 @@
<input type="text" class="form-control" id="urlServer" placeholder="WCS Server URL"/>
</div>
</div>
<div id="sipLoginForm" class="form-group">
<label class="control-label col-sm-3" for="sipLogin">Login</label>
<div id="loginForm" class="form-group">
<label class="control-label col-sm-3" for="login">Login</label>

<div class="col-sm-4">
<input type="text" class="form-control" id="sipLogin"
<input type="text" class="form-control" id="login"
placeholder="Login"/>
</div>
</div>
Expand Down
16 changes: 16 additions & 0 deletions client/src/examples/demo/video-chat/video-chat.css
Expand Up @@ -54,6 +54,7 @@ legend.scheduler-border {
.fp-muteVideoControls {
position: absolute;
top:250px;
width:320px;
}

input[type="checkbox"] {
Expand All @@ -62,4 +63,19 @@ input[type="checkbox"] {

.form-horizontal .checkbox {
min-height: 55px;
}

.fp-userState {
border-radius: 50%;
border-color: lightgray !important;
background-color: lightgray;
width: 15px;
height: 15px;
}

.fp-userState.online {
background-color: #d5f114;
}
.fp-userState.streaming {
background-color: #196a23;
}
129 changes: 59 additions & 70 deletions client/src/examples/demo/video-chat/video-chat.html
Expand Up @@ -10,7 +10,7 @@
<!-- custom css -->
<link rel="stylesheet" href="video-chat.css">

<title>Phone Video Minimal</title>
<title>Room Chat</title>

<!-- swfobject -->
<script type="text/javascript" src="../../../dependencies/swf/swfobject.js"></script>
Expand All @@ -34,6 +34,8 @@
<script type="text/javascript" src="../../../dependencies/jquery/jquery.json.js"></script>
<!-- ****** -->

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

<!-- WCS JavaScript API -->
<script type="text/javascript" src="../../ConfigurationLoader.js"></script>
<script type="text/javascript" src="../../../Flashphoner.js"></script>
Expand All @@ -44,75 +46,16 @@

<!-- Minimum script for calls -->
<script type="text/javascript" src="video-chat.js"></script>

<script>

/**
* Here we add Flashphoner API initialization code
*/
function initAPI() {

setURL();

f.addListener(WCSEvent.ErrorStatusEvent, errorEvent);
f.addListener(WCSEvent.ConnectionStatusEvent, connectionStatusListener);
f.addListener(WCSEvent.RegistrationStatusEvent, registrationStatusListener);
f.addListener(WCSEvent.CallStatusEvent, callStatusListener);
f.addListener(WCSEvent.OnCallEvent, callListener, this);
if (detectIE()) {
detectFlash();
}
// Configure remote and local video elements
var configuration = new Configuration();
configuration.remoteMediaElementId = 'remoteVideo';
configuration.localMediaElementId = 'localVideo';
configuration.elementIdForSWF = "flashVideoDiv";
configuration.pathToSWF = "../../../dependencies/flash/MediaManager.swf";
configuration.flashBufferTime = 0.0;

f.init(configuration);

// Hide WebRTC elements for IE and Flash based browsers. Hide flash elements for WebRTC based browsers.
if (webrtcDetectedBrowser) {
document.getElementById('remoteVideo').style.visibility = "visible";
document.getElementById('flashVideoWrapper').style.visibility = "hidden";
document.getElementById('flashVideoDiv').style.visibility = "hidden";
} else {
document.getElementById('remoteVideo').style.visibility = "hidden";
document.getElementById('flashVideoWrapper').style.visibility = "visible";
document.getElementById('localVideo').style.visibility = "hidden";
}
}

//New video call
function call() {
var call = new Call();
call.callee = field("callee");
// set true to make a video call
call.hasVideo = true;
currentCall = f.call(call);
}

//Answer with video
function answer() {
// set true to answer with video
currentCall.hasVideo = true;
f.answer(currentCall);
}


</script>

</head>

<body onload="initAPI()">
<body>

<!-- full size container -->
<div class="container-fluid">
<div class="row" style="max-width: 1024px">
<div class="col-sm-7 text-center">

<h1>Video Chat Minimal</h1>
<h1>Room Chat</h1>
<div id="notify" class="modal fade" role="dialog">
<div class="modal-dialog modal-sm">
<div class="modal-content">
Expand All @@ -132,19 +75,41 @@ <h3 class="modal-title text-center text-info">Info</h3>
<h2 id="notifyFlash" class="text-danger"></h2>

<!-- Connection fields -->
<fieldset id="callFieldSet" class="scheduler-border">
<!-- Include from call-fieldset.html by jquery. See js file. -->
<fieldset id="connectionFieldSet" class="scheduler-border">
<!-- Include from connect-fieldset.html by jquery. See js file. -->
</fieldset>

<!-- Call controls -->
<div id="callControls">
<!-- Include from call-controls.html. See js file. -->
</div>

<div class="row" style="margin-top: 20px">
<div class="col-sm-12">
<div class="form-group">
<div id="chat" style="overflow-y: scroll; height: 100px;" class="text-left form-control"></div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="form-group">
<textarea id="message" class="form-control" rows="1" style="resize: none;"></textarea>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-5 col-sm-offset-7">
<div class="pull-right">
<button id="sendBtn" type="button" class="btn btn-default" onclick="sendMessage(); return false;">Send</button>
</div>
</div>
</div>
</div>

<!-- Video block -->
<div class="col-sm-4 text-left fp-videoBlock">
<div class="col-sm-4 text-left fp-videoBlock participant free">

<div class="text-center text-info">
<span class="glyphicon fp-userState"></span>
<span class="p-login">Offline</span>
</div>

<!-- 320x240 Flash Video Block -->
<div id="flashVideoWrapper" class="fp-flashVideoWrapper">
Expand All @@ -160,8 +125,22 @@ <h2 id="notifyFlash" class="text-danger"></h2>
class="fp-localVideo">
</video>



<!-- Mute video controls -->
<div class="fp-muteVideoControls" id="videoControls">
<div class="fp-muteVideoControls text-center" id="videoControls">
<div class="row" style="margin-top: 20px">
<div class="col-sm-12">
<button id="publishBtn" type="button" class="btn btn-default">Start</button>
</div>
</div>

<div class="row" style="margin-top:10px">
<div class="col-sm-12 text-center">
<span id="publishStatus"></span>
</div>
</div>

<div class="row row-space">
<div class="col-sm-6 fp-buttonVerticalAlign">
Mute Audio
Expand Down Expand Up @@ -216,6 +195,16 @@ <h2 id="notifyFlash" class="text-danger"></h2>
</script>
</div>
</div>

<div class="col-sm-12 text-left" style="margin-top:20px">
<div class="form-group">
<label class="control-label col-sm-2" for="inviteLink">Invite Link</label>

<div class="col-sm-9">
<input type="text" class="form-control" id="inviteLink"/>
</div>
</div>
</div>
</div>
</div>

Expand Down

0 comments on commit feaf08f

Please sign in to comment.