docs: function initPeer(el) {
    var propValue = el.getAttribute('rtc-peer');
    var targetStream = el.getAttribute('rtc-stream');
    var peerRoles = propValue ? propValue.split(reSep) : ['*'];
  
    // create a data container that we will attach to the element
    var data = el._rtc || (el._rtc = {});
  
    function attachStream(stream) {
      debug('attaching stream');
      media(stream).render(el);
      data.streamId = stream.id;
    }
  
    function addStream(stream, peer) {
      // if we don't have a stream or already have a stream id then bail
      if (data.streamId) {
        return;
      }
  
      // if we have a particular target stream, then go looking for it
      if (targetStream) {
        debug('requesting stream data');
        sessionMgr.getStreamData(stream, function(data) {
          debug('got stream data', data);
  
          // if it's a match, then attach
          if (data && data.name === targetStream) {
            attachStream(stream);
          }
        });
      }
      // otherwise, automatically associate with the element
      else {
        attachStream(stream);
      }
    }
  
    // iterate through the peers and monitor events for that peer
    peerRoles.forEach(function(role) {
      eve.on('glue.peer.active.' + role, function(peer, peerId) {
        // if the element already has a peer, then do nothing
        if (data.peerId) {
          return;
        }
  
        debug('peer active', peer.getRemoteStreams());
  
        // associate the peer id with the element
        data.peerId = peerId;
  
        // add existing streams
        [].slice.call(peer.getRemoteStreams()).forEach(addStream);
  
        // listen for add stream events
        // NOTE: currently not in use as we have move to a non-reactive
        // coupling approach to ensure firefox compatibility
        // peer.addEventListener('addstream', function(evt) {
        //   addStream(evt.stream, peer);
        // });
      });
    });
  
    eve.on('glue.peer.leave', function(peer, peerId) {
      // if the peer leaving matches the remote peer, then cleanup
      if (data.peerId === peerId) {
        // reset the target media element
        resetEl(el);
  
        // reset the rtc data
        data = el._rtc = {};
      }
    });
  
    return el;
  }