[[ixnx:wrtc:js:tutorial:start|Tutorial]] Appendix: ====== Appendix ====== ===== Debugging ===== wrtc_kit logs a lot to the Javascript console of the web browser, making debug easier. To see the log simply press Ctrl+Shift+J in most browsers. At the bottom of the Javascript log is a command prompt. You can inspect and change all properties here. Try for instance to write **wrtc.addressName** and press enter. You can also log your own events into the log by calling [[ixnx:wrtc:js:api:wrtc:consolelog|wrtc.consoleLog()]] or [[ixnx:wrtc:js:api:wrtc:modulelog|wrtc.moduleLog()]] from your code. The console log can also be saved to local file on user's PC by calling [[ixnx:wrtc:js:api:wrtc:adv.savelog|wrtc.adv.saveLog()]]. You can also request the console log from the other part of a call by calling [[ixnx:wrtc:js:api:wrtc:adv.getlog|wrtc.adv.getLog()]] or [[ixnx:wrtc:js:api:call:adv.getlog|call.adv.getLog()]]. You should put a button calling these functions on your webpage for debug purposes. ===== Multiple Calls ===== The demo client in this tutorial can only make one call at a time. The page has a static video element called remoteVideo that displays the received call, wrtc_kit will automatically search for video element called remoteVideo for that purpose. But that is only for one call. If you want to have two simultaneous calls, talk to two different people at the same time, you will need to create video elements dynamically for each new call. The main wrtc_kit property deciding if your client will be able to handle one call at a time or multiple calls is [[ixnx:wrtc:js:api:wrtc:maxnrcalls|wrtc.maxNrCalls]]. By default it is 1 allowing only one call at a time. By setting it to 2 you can have 2 calls at a time, 10 will give you 10, etc. But you need to do more than simply increase the value. [[ixnx:wrtc:js:api:wrtc:onnewcallobject|wrtc.onNewCallObject()]] is an event function called each time wrtc_kit creates a new call. You can use this function to dynamically create video elements for each new call: wrtc.onNewCallObject = function(callobj) { var video = document.createElement('video'); video.autoplay = "autoplay"; callobj.remoteVideo = video; } And you can use [[ixnx:wrtc:js:api:wrtc:onendcallobject|wrtc.onEndCallObject()]] to dynamically remove the video elements too: wrtc.onEndCallObject = function(callobj) { callobj.remoteVideo.outerHTML = ""; } ==== User fields ==== By adding a user field to the call object you can even create own status fields for your calls: wrtc.onNewCallObject = function(callobj) { var div = document.createElement('div'); var statusdiv = document.createElement('div'); div.appendChild(statusdiv); var video = document.createElement('video'); video.autoplay = "autoplay"; div.appendChild(video); callobj.remoteVideo = video; callobj.user = {}; callobj.user.status = statusdiv; } The above code dynamically creates a new %%
%% element for each new call, that includes an inner %%
%% element to display status in, and a %%