]> git.sesse.net Git - ultimatescore/blobdiff - nageru/ultimate.lua
Find the location of the HTML file from the location of the Nageru theme.
[ultimatescore] / nageru / ultimate.lua
index 9bd4e17325bd2bd50548f90e601307fa170c9109..7d06451c8f1378fa7f48cdc6147979cc8ef50c12 100644 (file)
@@ -45,8 +45,14 @@ local FADE_TRANSITION = 2
 -- frame and not per field, since we deinterlace.
 local last_resolution = {}
 
-local caspar_input = VideoInput.new("unix:///tmp/caspar.sock", Nageru.VIDEO_FORMAT_BGRA)
-caspar_input:change_rate(2.0)
+local cef_path = Nageru.THEME_PATH:match("(.*)/nageru/")
+local cef_input = HTMLInput.new("file://" .. cef_path .. "/score.html")
+cef_input:execute_javascript_async("play()")
+
+function reload_cef()
+       cef_input:reload()
+       cef_input:execute_javascript_async("play()")
+end
 
 -- Utility function to help creating many similar chains that can differ
 -- in a free set of chosen parameters.
@@ -68,7 +74,7 @@ end
 
 -- An overlay with variable alpha.
 function make_overlay(chain, base)
-       local image = chain:add_video_input(caspar_input, false)
+       local image = chain:add_html_input(cef_input)
        local multiply_effect = chain:add_effect(MultiplyEffect.new())
        local overlay_effect = chain:add_effect(OverlayEffect.new(), base, multiply_effect)
        return {
@@ -233,7 +239,7 @@ end)
 -- A chain to show the overlay and nothing more. LQ only,
 -- since it is not a valid live signal.
 local overlay_chain_lq = EffectChain.new(16, 9)
-local overlay_chain_lq_input = overlay_chain_lq:add_video_input(caspar_input, false)
+local overlay_chain_lq_input = overlay_chain_lq:add_html_input(cef_input)
 overlay_chain_lq:finalize(false)
 
 -- Used for indexing into the tables of chains.
@@ -760,3 +766,7 @@ function calc_fade_progress(t, transition_start, transition_end)
 
        return tt
 end
+
+ThemeMenu.set(
+       { "Reload overlay", reload_cef }
+)