use crate::models::*; use std::error::Error as StdError; #[cfg(target_os = "linux")] mod linux; #[cfg(target_os = "macos")] mod macos; #[cfg(target_os = "windows")] mod windows; pub trait MediaController { fn initialize_session( &mut self, app_id: String, app_name: String, ) -> Result<(), Box>; fn set_metadata(&mut self, metadata: MediaMetadata) -> Result<(), Box>; fn set_playback_info(&mut self, info: PlaybackInfo) -> Result<(), Box>; fn set_playback_status(&mut self, status: PlaybackStatus) -> Result<(), Box>; fn set_position(&mut self, position: f64) -> Result<(), Box>; fn clear_metadata(&mut self) -> Result<(), Box>; fn set_event_handler(&mut self, handler: Box); // Get methods to retrieve current state fn get_metadata(&self) -> Result, Box>; fn get_playback_info(&self) -> Result, Box>; fn get_playback_status(&self) -> Result>; fn get_position(&self) -> Result>; fn is_enabled(&self) -> Result>; } pub fn create_media_controller() -> Box { #[cfg(target_os = "windows")] { Box::new(windows::WindowsMediaController::new()) } #[cfg(target_os = "macos")] { Box::new(macos::MacOSMediaController::new()) } #[cfg(target_os = "linux")] { Box::new(linux::LinuxMediaController::new()) } }