@@ -11,6 +11,7 @@ local user_opts = {
1111 showwindowed = true , -- show OSC when windowed?
1212 showfullscreen = true , -- show OSC when fullscreen?
1313 idlescreen = true , -- show mpv logo on idle
14+ audioonlyscreen = false , -- show mpv logo when no video
1415 scalewindowed = 1 , -- scaling of the controller when windowed
1516 scalefullscreen = 1 , -- scaling of the controller when fullscreen
1617 vidscale = " auto" , -- scale the controller with the video?
@@ -256,6 +257,8 @@ local state = {
256257 hide_timer = nil ,
257258 cache_state = nil ,
258259 idle = false ,
260+ no_video = false ,
261+ file_loaded = false ,
259262 enabled = true ,
260263 input_enabled = true ,
261264 showhide_enabled = false ,
@@ -2616,22 +2619,20 @@ local function render_logo()
26162619
26172620 local ass = assdraw .ass_new ()
26182621 -- mpv logo
2619- if user_opts .idlescreen then
2620- for _ , line in ipairs (logo_lines ) do
2621- ass :new_event ()
2622- ass :append (line_prefix .. line )
2623- end
2622+ for _ , line in ipairs (logo_lines ) do
2623+ ass :new_event ()
2624+ ass :append (line_prefix .. line )
26242625 end
26252626
26262627 -- Santa hat
2627- if is_december and user_opts . idlescreen and not user_opts .greenandgrumpy then
2628+ if is_december and not user_opts .greenandgrumpy then
26282629 for _ , line in ipairs (santa_hat_lines ) do
26292630 ass :new_event ()
26302631 ass :append (line_prefix .. line )
26312632 end
26322633 end
26332634
2634- if user_opts . idlescreen then
2635+ if state . idle then
26352636 ass :new_event ()
26362637 ass :pos (display_w / 2 , icon_y + 65 )
26372638 ass :an (8 )
@@ -2648,14 +2649,15 @@ tick = function()
26482649 end
26492650
26502651 if not state .enabled then return end
2651- if not state .idle then
2652- render_wipe (state .logo_osd )
2653- end
26542652
26552653 if state .idle then
26562654 -- render idle message
26572655 msg .trace (" idle message" )
2658- render_logo ()
2656+ if user_opts .idlescreen then
2657+ render_logo ()
2658+ else
2659+ render_wipe (state .osd )
2660+ end
26592661
26602662 if state .showhide_enabled then
26612663 mp .disable_key_bindings (" showhide" )
@@ -2665,6 +2667,11 @@ tick = function()
26652667 elseif state .fullscreen and user_opts .showfullscreen
26662668 or (not state .fullscreen and user_opts .showwindowed ) then
26672669
2670+ if state .no_video and state .file_loaded and user_opts .audioonlyscreen then
2671+ render_logo ()
2672+ else
2673+ render_wipe (state .logo_osd )
2674+ end
26682675 -- render the OSC
26692676 render ()
26702677 else
@@ -2798,6 +2805,20 @@ mp.observe_property("idle-active", "bool", function(_, val)
27982805 state .idle = val
27992806 request_tick ()
28002807end )
2808+ mp .observe_property (" current-tracks/video" , " native" , function (_ , val )
2809+ state .no_video = val == nil
2810+ request_tick ()
2811+ end )
2812+
2813+ mp .register_event (" file-loaded" , function ()
2814+ state .file_loaded = true
2815+ state .no_video = mp .get_property_native (" current-tracks/video" ) == nil
2816+ request_tick ()
2817+ end )
2818+ mp .add_hook (" on_unload" , 50 , function ()
2819+ state .file_loaded = false
2820+ request_tick ()
2821+ end )
28012822
28022823mp .observe_property (" display-fps" , " number" , set_tick_delay )
28032824mp .observe_property (" pause" , " bool" , pause_state )
0 commit comments