final tuch
This commit is contained in:
9103
src/Resurse/log.txt
9103
src/Resurse/log.txt
File diff suppressed because it is too large
Load Diff
@@ -9,6 +9,7 @@ from kivy.uix.video import Video # Import Video widget for video playback
|
|||||||
from kivy.uix.image import Image # Import Image widget for displaying images
|
from kivy.uix.image import Image # Import Image widget for displaying images
|
||||||
from kivy.logger import Logger # Import Logger for logging messages
|
from kivy.logger import Logger # Import Logger for logging messages
|
||||||
from kivy.lang import Builder # Import Builder for loading KV files
|
from kivy.lang import Builder # Import Builder for loading KV files
|
||||||
|
from kivy.animation import Animation # Import Animation for fade effects
|
||||||
import os # Import os for file and directory operations
|
import os # Import os for file and directory operations
|
||||||
import json # Import json for handling JSON data
|
import json # Import json for handling JSON data
|
||||||
import datetime # Import datetime for timestamping logs
|
import datetime # Import datetime for timestamping logs
|
||||||
@@ -138,22 +139,48 @@ class MediaPlayer(Screen):
|
|||||||
Logger.error(f"Unsupported media type for file: {file_name}")
|
Logger.error(f"Unsupported media type for file: {file_name}")
|
||||||
|
|
||||||
def play_video(self, file_path):
|
def play_video(self, file_path):
|
||||||
"""Play a video file."""
|
"""Play a video file with a fade-in effect."""
|
||||||
Logger.info(f"Playing video: {file_path}")
|
Logger.info(f"Playing video: {file_path}")
|
||||||
self.video_player.source = file_path # Set the video source
|
if not os.path.exists(file_path):
|
||||||
self.video_player.opacity = 1 # Make the video player visible
|
Logger.error(f"Video file not found: {file_path}")
|
||||||
|
return
|
||||||
|
|
||||||
|
# Set the video source and start playback
|
||||||
|
self.video_player.source = file_path
|
||||||
self.video_player.state = 'play' # Start playing the video
|
self.video_player.state = 'play' # Start playing the video
|
||||||
|
self.video_player.opacity = 0 # Start with the video hidden
|
||||||
self.image_display.opacity = 0 # Hide the image display
|
self.image_display.opacity = 0 # Hide the image display
|
||||||
Clock.schedule_once(self.next_media, self.video_player.duration) # Schedule the next media
|
|
||||||
|
# Wait for the video to start before applying the fade-in animation
|
||||||
|
def start_fade_in(*args):
|
||||||
|
fade_in = Animation(opacity=1, duration=1) # Fade in over 1 second
|
||||||
|
fade_in.start(self.video_player) # Start the fade-in animation
|
||||||
|
|
||||||
|
# Schedule the fade-in animation after a short delay
|
||||||
|
Clock.schedule_once(start_fade_in, 0.1)
|
||||||
|
|
||||||
|
# Schedule the next media after the video's duration
|
||||||
|
Clock.schedule_once(self.next_media, self.video_player.duration)
|
||||||
|
|
||||||
def show_image(self, file_path, duration):
|
def show_image(self, file_path, duration):
|
||||||
"""Display an image."""
|
"""Display an image with a fade-in effect."""
|
||||||
Logger.info(f"Showing image: {file_path}")
|
Logger.info(f"Showing image: {file_path}")
|
||||||
self.image_display.source = file_path # Set the image source
|
if not os.path.exists(file_path):
|
||||||
self.image_display.opacity = 1 # Make the image display visible
|
Logger.error(f"Image file not found: {file_path}")
|
||||||
self.image_display.reload() # Reload the image
|
return
|
||||||
|
|
||||||
|
# Set the image source
|
||||||
|
self.image_display.source = file_path
|
||||||
|
self.image_display.opacity = 0 # Start with the image hidden
|
||||||
|
self.image_display.reload() # Reload the image to ensure it updates
|
||||||
self.video_player.opacity = 0 # Hide the video player
|
self.video_player.opacity = 0 # Hide the video player
|
||||||
Clock.schedule_once(self.next_media, duration) # Schedule the next media
|
|
||||||
|
# Create a fade-in animation
|
||||||
|
fade_in = Animation(opacity=1, duration=1) # Fade in over 1 second
|
||||||
|
fade_in.start(self.image_display) # Start the fade-in animation
|
||||||
|
|
||||||
|
# Schedule the next media after the duration
|
||||||
|
Clock.schedule_once(self.next_media, duration)
|
||||||
|
|
||||||
def next_media(self, dt):
|
def next_media(self, dt):
|
||||||
"""Move to the next media in the playlist."""
|
"""Move to the next media in the playlist."""
|
||||||
|
|||||||
BIN
src/static/resurse/IMG-20250327-WA0003.jpg
Normal file
BIN
src/static/resurse/IMG-20250327-WA0003.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 446 KiB |
Binary file not shown.
Reference in New Issue
Block a user