From 147315fee2beabfd7580675c07486b219a6fe863 Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Wed, 12 Jun 2024 22:49:30 -0700 Subject: [PATCH] Video z-index workaround for Safari When the Safari browser puts a webcam video full-screen and then returns, the z-index of the video was higher than the buttons and controls normally overlaid on top of it. Add a z-index:1 to the video controls to keep them on top after returning from full screen. Similar: for popped-out draggable videos, adding a z-index:1 allows the video to correctly sit on top of docked videos without the docked video controls (zi:1) rendering above the popped-out video when you overlap them. Note: the z-index:1 is applied to popped-out and video controls, any other combination (e.g. 1 for popped-out and 2 for controls) caused controls of docked videos to render on top of popped-out ones when they overlapped. --- pkg/handlers.go | 2 +- pkg/messages/messages_test.go | 17 +++++------------ public/static/css/chat.css | 4 ++++ 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/pkg/handlers.go b/pkg/handlers.go index a8f6fb5..4245eca 100644 --- a/pkg/handlers.go +++ b/pkg/handlers.go @@ -593,7 +593,7 @@ func (s *Server) OnMute(sub *Subscriber, msg messages.Message, mute bool) { // OnBlock is a user placing a hard block (hide from) another user. func (s *Server) OnBlock(sub *Subscriber, msg messages.Message) { - log.Info("%s blocks %s: %v", sub.Username, msg.Username) + log.Info("%s blocks %s", sub.Username, msg.Username) // If the subject of the block is an admin, return an error. if other, err := s.GetSubscriber(msg.Username); err == nil && other.IsAdmin() { diff --git a/pkg/messages/messages_test.go b/pkg/messages/messages_test.go index 65b5c28..79730e4 100644 --- a/pkg/messages/messages_test.go +++ b/pkg/messages/messages_test.go @@ -38,12 +38,6 @@ func (f flags) Check(video int) error { return errors.New("Muted expected NOT to be set") } - if video&messages.VideoFlagIsTalking == messages.VideoFlagIsTalking && !f.IsTalking { - return errors.New("IsTalking expected to be set") - } else if video&messages.VideoFlagIsTalking != messages.VideoFlagIsTalking && f.IsTalking { - return errors.New("IsTalking expected NOT to be set") - } - if video&messages.VideoFlagMutualRequired == messages.VideoFlagMutualRequired && !f.MutualRequired { return errors.New("MutualRequired expected to be set") } else if video&messages.VideoFlagMutualRequired != messages.VideoFlagMutualRequired && f.MutualRequired { @@ -217,14 +211,13 @@ func TestVideoFlagMutation(t *testing.T) { }, { Mutate: func(v int) int { - return v | messages.VideoFlagOnlyVIP | messages.VideoFlagNSFW | messages.VideoFlagIsTalking + return v | messages.VideoFlagOnlyVIP | messages.VideoFlagNSFW }, Expect: flags{ - Active: true, - Muted: true, - OnlyVIP: true, - NSFW: true, - IsTalking: true, + Active: true, + Muted: true, + OnlyVIP: true, + NSFW: true, }, }, } diff --git a/public/static/css/chat.css b/public/static/css/chat.css index 0fb25b2..b81bad6 100644 --- a/public/static/css/chat.css +++ b/public/static/css/chat.css @@ -250,6 +250,7 @@ div.feed.popped-out { top: 0; left: 0; resize: none; + z-index: 1; /* work around Safari video being on top when return from fullscreen */ } .video-feeds.x1 > .feed { @@ -285,12 +286,14 @@ div.feed.popped-out { position: absolute; left: 4px; bottom: 4px; + z-index: 1; /* work around Safari video being on top when return from fullscreen */ } .feed > .close { position: absolute; right: 4px; top: 0; + z-index: 1; /* work around Safari video being on top when return from fullscreen */ } .feed > .caption { @@ -301,6 +304,7 @@ div.feed.popped-out { left: 4px; font-size: small; padding: 2px 4px; + z-index: 1; /* work around Safari video being on top when return from fullscreen */ } /* YouTube embeds */