From 391b030eee252fde5e71932c09c1e5ac5ccf9a8e Mon Sep 17 00:00:00 2001 From: Mike Lowis Date: Thu, 23 Jan 2025 15:49:29 -0500 Subject: [PATCH] fix bug with subtitles stacking --- atv/assets/index.html | 2 ++ atv/bin/atv-index | 2 +- atv/lib/atv/channel.rb | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/atv/assets/index.html b/atv/assets/index.html index 8fb7168..74bde56 100644 --- a/atv/assets/index.html +++ b/atv/assets/index.html @@ -78,6 +78,7 @@ const updatePlayer = (prev)=>{ { ImageView.style.display = "none"; Video.style.display = "none"; + Video.textTracks[0].mode = "hidden"; if (current["curr"]["type"] == "image") { @@ -90,6 +91,7 @@ const updatePlayer = (prev)=>{ Video.style.display = "block"; Video.src = current["curr"]["path"] + "#t=" + elapsed; SubtitleTrack.src = current["curr"]["path"] + ".vtt"; + Video.textTracks[0].mode = "showing"; if (current["playing"]) { Video.play() diff --git a/atv/bin/atv-index b/atv/bin/atv-index index 7347a83..c25ca32 100755 --- a/atv/bin/atv-index +++ b/atv/bin/atv-index @@ -4,7 +4,7 @@ require 'json' require 'fileutils' IMG_TYPES = %w[jpg jpeg png gif] -VID_TYPES = %w[mp4 ogg webm] +VID_TYPES = %w[mp4 m4v ogg webm] TYPES = "{#{(IMG_TYPES + VID_TYPES).join(",")}}" FILES = [] diff --git a/atv/lib/atv/channel.rb b/atv/lib/atv/channel.rb index bd23864..68cabd0 100644 --- a/atv/lib/atv/channel.rb +++ b/atv/lib/atv/channel.rb @@ -41,7 +41,8 @@ module ATV def pick_random() if not @ratios.nil? then - options = @ratios.map {|e| Array.new(e[1], e[0]) }.flatten.map{|k| filedata[:tree][k] }.compact + ratioed_options = @ratios.map {|e| Array.new(e[1], e[0]) }.flatten + options = ratioed_options.map{|k| filedata[:tree][k] }.compact else options = filedata[:tree].values end -- 2.54.0