Skip to content

Commit f5ea5c1

Browse files
committed
improv: disable videos if ffmpeg fails
1 parent aadbdfc commit f5ea5c1

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

maxima-ui/src/main.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,12 @@ struct Args {
8484
#[tokio::main]
8585
async fn main() {
8686
init_logger();
87-
ffmpeg::init().unwrap();
87+
let ffmpeg_success = if let Err(err) = ffmpeg::init() {
88+
log::error!("Unable to initialize ffmpeg {err:?}");
89+
false
90+
} else {
91+
true
92+
};
8893
let mut args = Args::parse();
8994

9095
if !cfg!(debug_assertions) {
@@ -124,7 +129,7 @@ async fn main() {
124129
"Maxima",
125130
native_options,
126131
Box::new(move |cc| {
127-
let app = MaximaEguiApp::new(cc, args);
132+
let app = MaximaEguiApp::new(cc, args, ffmpeg_success);
128133
// Run initialization code that needs access to the UI here, but DO NOT run any long-runtime functions here,
129134
// as it's before the UI is shown
130135
if args.no_login {
@@ -343,7 +348,7 @@ const F9B233: Color32 = Color32::from_rgb(249, 178, 51);
343348
const WIDGET_HOVER: Color32 = Color32::from_rgb(255, 188, 61);
344349

345350
impl MaximaEguiApp {
346-
fn new(cc: &eframe::CreationContext<'_>, args: Args) -> Self {
351+
fn new(cc: &eframe::CreationContext<'_>, args: Args, ffmpeg_success: bool) -> Self {
347352
let style: Style = Style {
348353
spacing: Spacing {
349354
scroll: ScrollStyle {
@@ -464,7 +469,7 @@ impl MaximaEguiApp {
464469
game_view_bg_renderer: GameViewBgRenderer::new(cc),
465470
app_bg_renderer: AppBgRenderer::new(cc),
466471
img_cache,
467-
app_bg_media_player: if settings.videos {
472+
app_bg_media_player: if settings.videos && ffmpeg_success {
468473
Some(Player::new(&cc.egui_ctx))
469474
} else { None },
470475
locale: TranslationManager::new(&settings.language),

0 commit comments

Comments
 (0)