UNPKG

pubnub-js-webrtc

Version:

Adds the ability to do 1-to-1 WebRTC audio/video calls with [PubNub](https://www.pubnub.com/?devrel_gh=pubnub-js-webrtc). The PubNub key set must have PubNub Presence enabled. The example folder app uses Xirsys to get TURN server access via a PubNub Funct

387 lines (335 loc) 6.46 kB
html, body { width: 100%; max-width: 100vw; height: 100%; margin: 0px; overflow: hidden; font-family: sans-serif; font-size: 20px; color: #e6e6e6; position: fixed; top: 0px; bottom: 0px; left: 0px; right: 0px; } body > div { width: inherit; height: inherit; } ::-webkit-scrollbar { width: 0px; background: transparent; } h1 { margin: 0px; font-size: 30px; } .hide { display: none; } .header { display: table; position: absolute; height: 80px; width: 100%; box-sizing: border-box; text-align: left; font-weight: bold; border-bottom: solid 1px #FFFFFF; z-index: 1; color: #FFFFFF; } .header div { display: table-cell; position: relative; vertical-align: middle; background-color: #333333; } .header .left { width: 250px; text-align: center; } .header .middle { width: auto; text-align: center; } .header .right { width: 250px; height: inherit; min-height: 100%; } .header .right .video-sample-container { display: table; margin: auto; box-sizing: border-box; } .header video { height: 60px; border: solid 1px #e6e6e6; } .header img { height: 60px; } .online-list { float: left; width: 250px; height: 100%; overflow-y: scroll; position: absolute; box-sizing: border-box; padding-top: 80px; background-color: #1E2531; } .online-list div { width: 100%; height: 60px; text-align: left; background-color: #101620; box-sizing: border-box; cursor: pointer; border-bottom: solid 1px #6D7582; } .online-list img { height: 100%; border-radius: 50%; float: left; margin-right: 10px; padding: 10px; box-sizing: border-box; } .online-list span { display: block; position: relative; top: 50%; transform: translateY(-50%); word-break: break-all; } .chat { float: left; max-height: 100%; min-height: 100%; width: 100%; overflow-y: scroll; left: 250px; padding-left: 250px; padding-top: 80px; box-sizing: border-box; background-color: #363D48; } .log { height: 100%; width: 100%; margin-bottom: 50px; } .log div { padding: 8px; } .log b { color: #FFFFFF; } .input-container textarea { width: 100%; height: 100%; padding: 0px 5px; margin: 0px; box-sizing: border-box; line-height: 24pt; resize: none; outline: none; font-size: 14px; border: solid 1px #e6e6e6; background-color: #6D7582; border-radius: 3px; color: #FFFFFF; font-family: inherit; } .input-container textarea::placeholder { color: #FFFFFF; font-family: sans-serif; } div.input-container { position: fixed; bottom: 0px; height: 50px; width: 100%; background-color: #1E2531; box-sizing: border-box; padding-right: 250px; } .input-container div { display: inline-block; padding: 0px; } .input-container .textarea-container { width: 100%; height: 100%; padding: 8px 50px 8px 8px; box-sizing: border-box; } .input-container .submit { display: table; top: 0px; right: 250px; position: absolute; height: 100%; width: 50px; padding: 8px; box-sizing: border-box; fill: #FFFFFF; user-select: none; cursor: pointer; } .input-container .submit div { display: table-cell; height: 100%; vertical-align: middle; text-align: center; } .input-container .submit div svg { vertical-align: middle; } .video-modal { position: absolute; height: 100%; width: 100%; background-color: #000000; } .video-modal .close-video { position: absolute; display: flex; border-radius: 50%; background-color: #363D48; fill: #6D7582; padding: 1%; right: 1%; top: 1%; cursor: pointer; z-index: 1; } .video-modal img { position: absolute; width: 15%; bottom: 0px; right: 0px; } .video-modal video.me { position: absolute; width: 15%; bottom: 0px; right: 0px; border: solid 1px #e6e6e6; } .video-modal video.remote { display: block; height: 100%; max-width: 100%; margin: auto; } .modal-background { position: absolute; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.8); z-index: 2; } .user-input-modal h3 { margin: 15px auto; } .user-input-modal p { margin: 0px auto 20px auto; } .user-input-modal { position: relative; top: 50%; transform: translateY(-50%); max-width: 400px; min-width: 300px; overflow: hidden; margin: auto; padding: 15px; box-sizing: border-box; background-color: #363D48; border: solid 1px #e6e6e6; border-radius: 8px; color: #FFFFFF; text-align: center; } .user-input-modal .modal-button { display: inline-block; width: 100px; margin: 0px 10px 20px 10px; padding: 5px; box-sizing: border-box; background-color: #101620; color: #e6e6e6; border: solid 1px #6D7582; border-radius: 3px; user-select: none; cursor: pointer; } .user-input-modal .modal-button:hover { color: #FFFFFF; border: solid 1px #e6e6e6; } .user-input-modal .modal-button.disabled { opacity: 0.2; } .user-input-modal .modal-button.disabled:hover { color: #e6e6e6; border: solid 1px #6D7582; } .user-input-modal .modal-text-input { width: 80%; padding: 0px 5px; margin: 0px auto 20px auto; line-height: 24pt; outline: none; font-size: 14px; border: solid 1px #e6e6e6; background-color: #6D7582; border-radius: 3px; color: #FFFFFF; font-family: inherit; text-align: center; } .chat-interface { overflow: hidden; } @media only screen and (max-width: 700px) { h1 { font-size: 20px } html, body { font-size: 16px; } } @media only screen and (max-width: 450px) { .online-list, .header .right, .header .left { width: 100px; } .chat { left: 100px; padding-left: 100px; } div.input-container { height: 75px; padding-right: 100px; } .log { margin-bottom: 75px; } .input-container .submit { right: 100px; } .online-list img { height: 75%; margin: 6px 0px; } .video-modal .close-video { padding: 4%; } }