openvidu-electron: update to fit docs
This commit is contained in:
parent
00252652ea
commit
e08195ea68
3679
openvidu-electron/package-lock.json
generated
Normal file
3679
openvidu-electron/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,7 @@
|
||||
"productName": "openvidu-electron",
|
||||
"version": "1.0.0",
|
||||
"description": "OpenVidu Electron Tutorial",
|
||||
"main": "src/index.js",
|
||||
"main": "src/main.js",
|
||||
"scripts": {
|
||||
"start": "electron-forge start",
|
||||
"package": "electron-forge package",
|
||||
|
||||
@ -30,20 +30,18 @@ function initPublisher() {
|
||||
|
||||
function joinSession() {
|
||||
|
||||
mySessionId = document.getElementById("sessionId").value;
|
||||
|
||||
session = openvidu.initSession();
|
||||
session.on("streamCreated", function (event) {
|
||||
session.subscribe(event.stream, "subscriber");
|
||||
});
|
||||
|
||||
mySessionId = document.getElementById("sessionId").value;
|
||||
|
||||
getToken(mySessionId).then(token => {
|
||||
session.connect(token)
|
||||
.then(() => {
|
||||
showSession();
|
||||
if (!!publisher) {
|
||||
session.publish(publisher);
|
||||
}
|
||||
session.publish(publisher);
|
||||
})
|
||||
.catch(error => {
|
||||
console.log("There was an error connecting to the session:", error.code, error.message);
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
@ -7,9 +8,11 @@
|
||||
<link rel="styleSheet" href="style.css" type="text/css" media="screen">
|
||||
<script src="openvidu-browser-2.10.0.js"></script>
|
||||
<script src="axios.min.js"></script>
|
||||
<script src="app.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>OpenVidu Electron</h1>
|
||||
<!-- All of the Node.js APIs are available in this renderer process. -->
|
||||
We are using Node.js <script>
|
||||
@ -22,8 +25,6 @@
|
||||
document.write(process.versions.electron)
|
||||
</script>
|
||||
|
||||
<script src="app.js"></script>
|
||||
|
||||
<div id="join">
|
||||
<h1>Join a video session</h1>
|
||||
<form onsubmit="initPublisher(); return false">
|
||||
|
||||
@ -47,13 +47,16 @@
|
||||
|
||||
const ipcRenderer = require('electron').ipcRenderer;
|
||||
|
||||
// Call Electron API to list all available screens
|
||||
desktopCapturer.getSources({
|
||||
types: ['window', 'screen']
|
||||
}).then(async sources => {
|
||||
const list = document.getElementById("list-of-screens");
|
||||
sources.forEach(source => {
|
||||
// Add new element to the list with the thumbnail of the screen
|
||||
var el = document.createElement("div");
|
||||
el.onclick = () => {
|
||||
// Style the new selected screen and store it as the current selection
|
||||
htmlElements.forEach(e => {
|
||||
e.style.border = "none";
|
||||
e.style.background = "none";
|
||||
@ -63,12 +66,14 @@
|
||||
selectedElement = el;
|
||||
document.getElementById("share-btn").disabled = false;
|
||||
}
|
||||
// Store the new source and the new created HTML element
|
||||
availableScreens.push(source);
|
||||
htmlElements.push(el);
|
||||
var img = document.createElement("img");
|
||||
var name = document.createElement("span");
|
||||
img.src = source.thumbnail.toDataURL();
|
||||
name.innerHTML = source.name;
|
||||
// Append new elements to the template
|
||||
el.appendChild(img);
|
||||
el.appendChild(name);
|
||||
list.appendChild(el);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user