stuff and pain!

This commit is contained in:
Nickiel12 2024-08-22 21:02:08 -07:00
parent 95f628ce44
commit 39c62db5f5
5 changed files with 18 additions and 12 deletions

1
.gitignore vendored
View file

@ -3,3 +3,4 @@ settings.toml
.direnv/*
logs/*
ui/static/node_modules/*
ui/static/@tauri-apps/*

View file

@ -4,7 +4,7 @@
use std::{sync::{Arc, Mutex}, time::Duration};
use async_channel::Sender;
use tokio::{runtime, sync:: RwLock};
use tracing::{self, info, error};
use tracing::{self, debug, info, error};
use tauri::{AppHandle, Manager, Window};
use lazy_static::lazy_static;
@ -45,10 +45,9 @@ fn main() {
}
#[cfg(all(not(feature = "tokio-debug"), debug_assertions))]
{
let sub = tracing_subscriber::FmtSubscriber::new();
if let Err(e) = tracing::subscriber::set_global_default(sub) {
panic!("Could not set tracing global: {e}");
}
let _sub = tracing_subscriber::fmt()
.with_max_level(tracing_subscriber::filter::LevelFilter::DEBUG)
.init();
}
#[cfg(feature = "tokio-debug")]
{
@ -94,6 +93,7 @@ fn main() {
match msg {
vcs_common::ApplicationMessage::WebRTCPacket(msg) => {
debug!("Got a message from the webrtc connection! {:?}", msg);
handle.emit_all("frontend_message", serde_json::to_string(&msg).unwrap()).unwrap();
}
}
@ -122,6 +122,7 @@ fn main() {
if let Ok(e) = TO_WEBRTC.lock() {
match e.as_ref() {
Some(to_webrtc) => {
debug!("Sending message to the webrtc connection");
if let Err(e) = to_webrtc.send_blocking(ApplicationMessage::WebRTCPacket(serde_json::from_str(payload).expect("Could not decode the browser's sdp"))) {
error!("Could not send to mec! {e}");
}

View file

@ -3,7 +3,7 @@
<head>
<link href="/static/main.css" rel="stylesheet"/>
<script src="/static/feather.min.js"></script>
<script src="/static/index.js"></script>
<script src="/static/index.js" type="module"></script>
</head>
<body>

View file

@ -1,4 +1,5 @@
const { invoke } = window.__TAURI__.tauri;
import { videoview } from "./rtc.js";
function call_camera_connect() {
invoke("connect_to_camera", {})

View file

@ -1,5 +1,5 @@
import { emit, listen } from '@tauri-apps/api/event';
const { emit, listen } = window.__TAURI.tauri.event;
const videoview = document.getElementById("remoteview");
@ -42,6 +42,7 @@ pc.oniceconnectionstatechange = () => {
let ignoreOffer = false;
console.log("registering listner");
const application_message = await listen('frontend_message', async (event) => {
console.log("Event: ");
console.log(event);
@ -81,9 +82,11 @@ const application_message = await listen('frontend_message', async (event) => {
});
async function start_rtc_connection() {
try {
const stream = await navigator.mediaDevices.getUserMedia({ audio: false, video: false });
// async function start_rtc_connection() {
//try {
// const stream = await navigator.mediaDevices.getUserMedia({ audio: false, video: false });
}
}
//}
//}
export { videoview };