53 lines
1.4 KiB
Rust
53 lines
1.4 KiB
Rust
// file: src/lib.rs
|
|
|
|
mod app_state;
|
|
mod commands;
|
|
mod error;
|
|
mod media_audio;
|
|
mod media_av;
|
|
mod media_video;
|
|
|
|
fn init_tracing() {
|
|
let subscriber_result = tracing_subscriber::fmt()
|
|
.with_env_filter(
|
|
tracing_subscriber::EnvFilter::try_from_default_env()
|
|
.unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("info")),
|
|
)
|
|
.try_init();
|
|
|
|
if let Err(error) = subscriber_result {
|
|
eprintln!("failed to init tracing: {error}");
|
|
}
|
|
}
|
|
|
|
fn init_gstreamer() {
|
|
let init_result = gstreamer::init();
|
|
if let Err(error) = init_result {
|
|
panic!("failed to init gstreamer: {error}");
|
|
}
|
|
}
|
|
|
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
|
pub fn run() {
|
|
init_tracing();
|
|
init_gstreamer();
|
|
|
|
let builder = tauri::Builder::default()
|
|
.plugin(tauri_plugin_opener::init())
|
|
.manage(app_state::AppState::new())
|
|
.invoke_handler(tauri::generate_handler![
|
|
commands::start_audio_recording,
|
|
commands::stop_audio_recording,
|
|
commands::start_video_recording,
|
|
commands::stop_video_recording,
|
|
commands::get_video_preview_frame_base64,
|
|
commands::start_av_recording,
|
|
commands::stop_av_recording,
|
|
]);
|
|
|
|
let run_result = builder.run(tauri::generate_context!());
|
|
if let Err(error) = run_result {
|
|
tracing::error!(%error, "tauri run failed");
|
|
}
|
|
}
|