-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
bevy_light_field/tools/viewer.rs
Line 377 in 6d1fcd2
| // TODO: build pipeline config from args |
}
fn automatic_recording(
mut commands: Commands,
time: Res<Time>,
mut ev_person: EventReader<PersonDetectedEvent>,
stream_manager: Res<RtspStreamManager>,
mut live_session: ResMut<LiveSession>,
mut person_timeout: Local<Stopwatch>,
) {
if live_session.0.is_some() {
if person_timeout.elapsed_secs() > 3.0 {
person_timeout.reset();
println!("no person detected for 3 seconds, stopping recording");
let session_entity = live_session.0.take().unwrap();
let raw_streams = stream_manager.stop_recording();
commands.entity(session_entity)
.insert(RawStreams {
streams: raw_streams,
});
}
person_timeout.tick(time.delta());
for _ev in ev_person.read() {
person_timeout.reset();
}
return;
}
for ev in ev_person.read() {
println!("person detected: {:?}", ev);
// TODO: deduplicate start recording logic
let session = Session::new("capture".to_string());
stream_manager.start_recording(
&session,
);
// TODO: build pipeline config from args
let entity = commands.spawn(
StreamSessionBundle {
session: session,
raw_streams: RawStreams::default(),
config: PipelineConfig::default(),
},
).id();
live_session.0 = Some(entity);
break;
}
}