Enhance media API transcoding and video streaming capabilities
- Added support for limiting concurrent transcoding operations in the media API to prevent resource exhaustion. - Implemented functions to retrieve video duration and bitrate using ffprobe for improved streaming performance. - Enhanced the generate_transcoded_stream function to handle HTTP range requests, allowing for more efficient video playback. - Updated VideoModal component to disable fluid and responsive modes, ensuring proper container boundaries during video playback. - Improved logging throughout the transcoding process for better error tracking and debugging.
This commit is contained in:
@@ -12,7 +12,7 @@ import paho.mqtt.client as mqtt
|
||||
|
||||
from ..core.config import Config, MQTTConfig
|
||||
from ..core.state_manager import StateManager
|
||||
from ..core.events import EventSystem, EventType, publish_machine_state_changed
|
||||
from ..core.events import EventSystem, EventType
|
||||
from .handlers import MQTTMessageHandler
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ from typing import Dict, Optional
|
||||
from datetime import datetime
|
||||
|
||||
from ..core.state_manager import StateManager, MachineState
|
||||
from ..core.events import EventSystem, publish_machine_state_changed
|
||||
from ..core.events import EventSystem, EventType
|
||||
|
||||
|
||||
class MQTTMessageHandler:
|
||||
@@ -47,7 +47,16 @@ class MQTTMessageHandler:
|
||||
if state_changed:
|
||||
self.logger.info(f"📡 MQTT: Machine {machine_name} state changed to: {normalized_payload}")
|
||||
self.logger.info(f"📡 Publishing MACHINE_STATE_CHANGED event for {machine_name} -> {normalized_payload}")
|
||||
publish_machine_state_changed(machine_name=machine_name, state=normalized_payload, source="mqtt_handler")
|
||||
# Use the event_system instance passed to this handler, not the global one
|
||||
self.event_system.publish(
|
||||
EventType.MACHINE_STATE_CHANGED,
|
||||
"mqtt_handler",
|
||||
{
|
||||
"machine_name": machine_name,
|
||||
"state": normalized_payload,
|
||||
"previous_state": None
|
||||
}
|
||||
)
|
||||
self.logger.info(f"✅ Published MACHINE_STATE_CHANGED event for {machine_name} -> {normalized_payload}")
|
||||
else:
|
||||
self.logger.info(f"📡 Machine {machine_name} state unchanged (still {normalized_payload}) - no event published")
|
||||
|
||||
Reference in New Issue
Block a user