Common UI interaction patterns for working with rtc.io modules
npm install rtc-uiThis is a collection of user interface helper functions that can be used
in conjunction with other rtc.io modules.



Provides a number of helper functions for rendering both local and remote
streams to the DOM. Also provides a top level streamui function that chain
be used as a quickconnect "plugin" to automatically wire up these helper
functions for typical usage.
An example of usage is provided below:
``js
var quickconnect = require('rtc-quickconnect');
var capture = require('rtc-capture');
var streamui = require('rtc-ui/stream');
var conference;
capture({ video: true, audio: true }, function(err, stream) {
if (err) {
return console.error(err);
}
// create the conference
conference = quickconnect('https://switchboard.rtc.io/', {
room: 'rtc-ui:conference-example'
});
// add the local stream to the conference
conference.addStream(stream);
// render the local stream using the stream ui
streamui.local(document.body)(stream);
// use streamui to automatically handle element creation and removal
streamui(conference, { container: document.body });
});
`
#### streamui(qc, opts)
Link standard quickconnect events to sensible streamui handlers. Use opts
to provide configuration to the handler functions, notably:
- container - the container element in which new elements will be createddocument.body
within and searches for element removal will be constrained to. Defaults
to .
- plugins - If you are using any rtc.io plugins specify these here to havertc-attach
them passed on to for integration.
#### streamui.local(container, opts?) => fn(stream)
Create a handler function specifying a target container and any
additional options. The handler function expects a single argument
of stream for which a rendering element will be created and added
to the specified container.
This element will have the rtc abd localvideo classes applied to
it so can be styled using CSS by your app.
#### streamui.add(container, opts?) => fn(id, stream)
Create a handler function that is designed to respond to stream:addedrtc-quickconnect
events generated by (i.e it follows the (id, stream) functioncontainer
signature). A renderer element will be created for the stream and appended
to the element.
This element will have the rtc and remotevideo classes applied to it, anddata-peer
will also have and data-stream attributes set on the created
element.
#### streamui.remove(container, opts?) => fn(id, stream?)
Create a handler function that is designed to respond to both stream:removedcall:ended
and events generated by rtc-quickconnect. When the handler isdata-peer
invoked with just an id, all elements with the matching thecontainer
specified value will be removed from . If a stream argument valuedata-stream` label will be removed.
is supplied, then only those matching the
Copyright (c) 2015, National ICT Australia Limited (NICTA)
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.