-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Benedikt Strehle
committed
Mar 5, 2024
1 parent
9c88518
commit c93f557
Showing
7 changed files
with
38 additions
and
50 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
Empty file.
Empty file.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -5,7 +5,8 @@ | |
"jsx": "react-jsx", | ||
"jsxImportSource": "uix", | ||
"lib": [ | ||
"deno.window" | ||
"deno.window", | ||
"dom" | ||
] | ||
} | ||
} |
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 |
---|---|---|
@@ -1,5 +1,35 @@ | ||
import { CallView } from "common/CallView.tsx"; | ||
import { Endpoint } from "unyt_core/types/addressing.ts"; | ||
import { Runtime } from "unyt_core/datex_all.ts"; | ||
|
||
export default <div> | ||
<CallView /> | ||
</div> | ||
const remoteEndpointName = eternal ?? $$(new URLSearchParams(globalThis.location.search).get("remote") ?? "" as "@") | ||
|
||
const src = await navigator.mediaDevices.getUserMedia({ video: true, audio: true }); | ||
const ownVideo = <video autoplay id="ownVideo" src={src} /> | ||
const remoteVideo = <video autoplay id="remoteVideo" /> | ||
|
||
|
||
@endpoint class CallManager { | ||
@property static call(mediaStream: MediaStream) { | ||
console.warn("call from " + datex.meta.sender, mediaStream); | ||
remoteVideo.srcObject = mediaStream; | ||
return src; | ||
} | ||
} | ||
|
||
export default | ||
<div> | ||
<h1>Video Call</h1> | ||
<div>Own Endpoint: {Runtime.endpoint.toString()}</div> | ||
<div>Remote Endpoint: <input type="text" placeholder="@example" value={remoteEndpointName}/></div> | ||
<button onclick={async ()=>{ | ||
const endpoint = Endpoint.get(remoteEndpointName.val); | ||
const remoteStream = await CallManager.call.to(endpoint)(src); | ||
console.warn("remote", remoteStream) | ||
remoteVideo.srcObject = remoteStream | ||
}}>Call</button> | ||
|
||
<div class="callView"> | ||
{ownVideo} | ||
{remoteVideo} | ||
</div> | ||
</div> |