This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.listen(PORT, () => { | |
console.log(`Listening on port: ${PORT}`); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const nocache = (req, resp, next) => { | |
resp.header('Cache-Control', 'private, no-cache, no-store, must-revalidate'); | |
resp.header('Expires', '-1'); | |
resp.header('Pragma', 'no-cache'); | |
next(); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sendChannelMessage(property, direction){ | |
if (localStreams.rtmActive) { | |
// use a JSON object to send our instructions in a structured way | |
const jsonMsg = { | |
property: property, | |
direction: direction | |
}; | |
// build the Agora RTM Message | |
const msg = { | |
description: undefined, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Agora settings | |
const agoraAppId = ''; // insert Agora AppID here | |
const channelName = 'WebAR'; | |
var streamCount = 0; | |
// video profile settings | |
var cameraVideoProfile = '720p_6'; // 960 × 720 @ 30fps & 750kbs | |
// set log level: | |
// -- .DEBUG for dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create client | |
var client = AgoraRTC.createClient({mode: 'live', codec: 'vp8'}); // vp8 to work across mobile devices | |
const agoraAppId = ''; // insert Agora AppID here | |
const channelName = 'WebAR'; | |
var streamCount = 0; | |
// set log level: | |
// -- .DEBUG for dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function connectStreamToVideo(agoraStream, video) { | |
video.srcObject = agoraStream.stream;// add video stream to video element as source | |
video.onloadedmetadata = () => { | |
// ready to play video | |
video.play(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createBroadcaster(streamId) { | |
// create video element | |
var video = document.createElement('video'); | |
video.id = "faceVideo-" + streamId; | |
video.setAttribute('webkit-playsinline', 'webkit-playsinline'); | |
video.setAttribute('playsinline', 'playsinline'); | |
video.setAttribute('poster', '/imgs/no-video.jpg'); | |
console.log(video); | |
// add video object to the DOM | |
document.querySelector("a-assets").appendChild(video); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
margin: 0; | |
padding: 0; | |
} | |
body .btn:focus{ | |
outline: none !important; | |
box-shadow:none !important; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype HTML> | |
<html> | |
<head> | |
<title>Agora AR.js - Live Streamed WebAR</title> | |
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> | |
</head> | |
<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script> | |
<script src="https://rawgit.com/jeromeetienne/AR.js/master/aframe/build/aframe-ar.min.js"></script> | |
<script src="js/AgoraRTCSDK-3.0.2.js" type="text/javascript"></script> | |
<script src="js/agora-rtm-sdk-1.2.2.js" type="text/javascript"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html lang="en"> | |
<head> | |
<title>Agora.io AFrame [HOST] - Live Stream WebVR</title> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<!-- FontAwesome and Bootstrap CSS --> | |
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous"> | |
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet"> | |
<link href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.0/animate.min.css" rel="stylesheet"> | |
<!-- jQuery and Bootstrap JS --> |