generated from phazonoverload/vonage-project-template
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kevin Lewis
committed
Oct 2, 2020
1 parent
5a48e80
commit 8b89b35
Showing
3 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Build a Thing Video App</title> | ||
</head> | ||
<body> | ||
<div id="publishers"></div> | ||
<div id="subscribers"></div> | ||
|
||
<script src="https://static.opentok.com/v2/js/opentok.min.js"></script> | ||
<script> | ||
const params = Object.fromEntries(new URLSearchParams(location.search)) | ||
fetch(`/api/session?room=${params.room}`) | ||
.then(r => r.json()) | ||
.then(({ apiKey, sessionId, token }) => { | ||
const session = OT.initSession(apiKey, sessionId) | ||
const camera = OT.initPublisher('publishers', { mirror: false }) | ||
session.connect(token, () => { | ||
session.publish(camera) | ||
}) | ||
session.on('streamCreated', event => { | ||
session.subscribe(event.stream, 'subscribers') | ||
}) | ||
}) | ||
</script> | ||
</body> | ||
</html> |
This file contains 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