Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,7 @@ fn main() -> Result<(), wry::Error> {
webview: &wry::WebView| {
let html = match &item {
Item::Image(id) => include_str!("../ui/image.html").replace("IMAGE_SRC", id),
_ => {
// TODO: Implement displaying videos.
return;
}
Item::Video(id, _) => include_str!("../ui/video.html").replace("VIDEO_SRC", id),
};
*previous_item = current_item.take();
current_item = Some(item);
Expand Down Expand Up @@ -188,7 +185,7 @@ async fn item_load_loop(proxy: EventLoopProxy<UserEvent>) {
Ok((item, all_items)) => {
interval = match &item {
Item::Image(_) => all_items.interval,
Item::Video(_, duration) => *duration * 2,
Item::Video(_, duration) => std::cmp::max(*duration * 2, all_items.interval),
};
let _ = proxy.send_event(UserEvent::LoadItem(item));
Some(all_items)
Expand Down
28 changes: 28 additions & 0 deletions ui/video.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<html>

<head>
<style>
html {
background-color: black;
}
video {
object-fit: contain;
}
</style>
<script>
window.addEventListener('click', () => window.ipc.postMessage('onClick'))
</script>
</head>

<body>
<video
autoplay="true"
loop="true"
muted="true"
height="100%"
width="100%">
<source src="http://slideshow.localhost/VIDEO_SRC" />
</video>
</body>

</html>