Skip to content

Commit

Permalink
add basic implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Benedikt Strehle committed Mar 5, 2024
1 parent 9c88518 commit c93f557
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 50 deletions.
3 changes: 2 additions & 1 deletion app.dx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: "Hello UIX",
description: "A simple UIX app project";
description: "A simple UIX app project"
source_maps: true;

plugin git_deploy (
prod: {
Expand Down
10 changes: 0 additions & 10 deletions backend/data.ts

This file was deleted.

Empty file removed backend/entrypoint.ts
Empty file.
Empty file removed common/CallView.css
Empty file.
34 changes: 0 additions & 34 deletions common/CallView.tsx

This file was deleted.

3 changes: 2 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"jsx": "react-jsx",
"jsxImportSource": "uix",
"lib": [
"deno.window"
"deno.window",
"dom"
]
}
}
38 changes: 34 additions & 4 deletions frontend/entrypoint.tsx
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>

0 comments on commit c93f557

Please sign in to comment.