Release v0.2.16
This commit is contained in:
parent
9aac91ccb1
commit
d1bdefdeff
5 changed files with 39 additions and 6 deletions
|
|
@ -2441,6 +2441,26 @@ impl MediaViewerWindow {
|
|||
status_label.set_text(&format!("동영상을 재생할 수 없습니다: {error}"));
|
||||
}
|
||||
});
|
||||
let loop_check = loop_check.downgrade();
|
||||
stream.connect_ended_notify(move |stream| {
|
||||
let Some(check) = loop_check.upgrade() else {
|
||||
return;
|
||||
};
|
||||
if !video_loop_restart_needed(stream.is_ended(), check.is_active()) {
|
||||
return;
|
||||
}
|
||||
let stream = stream.clone();
|
||||
let loop_check = loop_check.clone();
|
||||
glib::timeout_add_local_once(Duration::from_millis(50), move || {
|
||||
let Some(check) = loop_check.upgrade() else {
|
||||
return;
|
||||
};
|
||||
if video_loop_restart_needed(stream.is_ended(), check.is_active()) {
|
||||
stream.seek(0);
|
||||
stream.play();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
controller.connect_signals();
|
||||
controller.fullscreen_changed();
|
||||
|
|
@ -4064,6 +4084,10 @@ fn video_volume_target(volume: f64, delta: f64) -> f64 {
|
|||
(volume + delta).clamp(0.0, 1.0)
|
||||
}
|
||||
|
||||
fn video_loop_restart_needed(ended: bool, loop_active: bool) -> bool {
|
||||
ended && loop_active
|
||||
}
|
||||
|
||||
fn initialize_video_volume(stream: >k::MediaStream) {
|
||||
let volume = stream.volume().clamp(0.0, 1.0);
|
||||
// Force the realized playback backend and GTK controls to receive the same initial value.
|
||||
|
|
@ -4220,6 +4244,14 @@ mod tests {
|
|||
assert_eq!(video_volume_target(0.5, 0.05), 0.55);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn video_loop_restarts_only_after_ending_when_enabled() {
|
||||
assert!(video_loop_restart_needed(true, true));
|
||||
assert!(!video_loop_restart_needed(false, true));
|
||||
assert!(!video_loop_restart_needed(true, false));
|
||||
assert!(!video_loop_restart_needed(false, false));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn image_pan_moves_at_most_100_pixels_and_consumes_clipped_axis() {
|
||||
assert_eq!(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue