cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

	<title>WebRTC with SkylinkJS</title>
	<script src="//cdn.temasys.io/skylink/skylinkjs/0.6.x/skylink.complete.js"></script>

    <a href="https://temasys.github.io" target="_blank">SkylinkJS on Github</a>
    You're in a private room. Please click &quot;Start&quot;, allow access to your microphone and camera and <a href="https://codepen.io/temasys/pen/GogabE" target="_blank">click here</a> to open this page in a new tab. You're joining yourself for a fun call ;)
  <p id="status">Loading room information...</p>
  <div id="start">
    <button  onclick="start(event)">Start</button><br/>
    <video id="myvideo" autoplay muted></video>
              header {
  background: #eee;
  padding: 20px;
  font-family: Helvetica, Arial, sans-serif;

header a:first-child {
  float: right;
  margin: 0 0 20px 30px;

button {
  display: inline-block;
  position: relative;
  top: 110px;
  left: 110px;
  z-index: 10;

video {
  width: 267px;
  height: 200px;
  border: 1px solid white;
  outline: 1px solid #ccc;
  z-index: 5;

#myvideo {
  transform: rotateY(-180deg);

#start {
  display: none;
              var skylink = new Skylink();
skylink.on('peerJoined', function(peerId, peerInfo, isSelf) {
  if(isSelf) return; // We already have a video element for our video and don't need to create a new one.
  var vid = document.createElement('video');
  vid.autoplay = true;
  vid.muted = true; // Added to avoid feedback when testing locally
  vid.id = peerId;

skylink.on('incomingStream', function(peerId, stream, isSelf) {
  if(isSelf) return;
  var vid = document.getElementById(peerId);
  attachMediaStream(vid, stream);

skylink.on('peerLeft', function(peerId) {
  var vid = document.getElementById(peerId);

skylink.on('mediaAccessSuccess', function(stream) {
  var vid = document.getElementById('myvideo');
  attachMediaStream(vid, stream);

  apiKey: 'f1773757-5f8b-42dc-b1ef-2374066866f6', // Get your own key at https://console.temasys.io
  defaultRoom: 'GogabE'//getRoomId()
}, function (error, success) {
  if (error) {
    document.getElementById('status').innerHTML = 'Failed retrieval for room information.<br>Error: ' + (error.error.message || error.error);
  } else {
       document.getElementById('status').innerHTML = 'Room information has been loaded. Room is ready for user to join.';
    document.getElementById('start').style.display = 'block';

function start(event) {
  event.target.style.visibility = 'hidden';
    audio: true,
    video: true
  }, function (error, success) {
    if (error) {
      document.getElementById('status').innerHTML = 'Failed joining room.<br>' +
  'Error: ' + (error.error.message || error.error);
    } else {
      document.getElementById('status').innerHTML = 'Joined room.';

/* Helper functions */

function getRoomId() {
  var roomId = document.cookie.match(/roomId=([a-z0-9-]{36})/);
  if(roomId) {
    return roomId[1];
  else {
    roomId = skylink.generateUUID();
    var date = new Date();
    date.setTime(date.getTime() + (30*24*60*60*1000));
    document.cookie = 'roomId=' + roomId + '; expires=' + date.toGMTString() + '; path=/';
    return roomId;

Loading ..................