Skip to content

Commit bd1cccc

Browse files
committed
updated functionality and styling
1 parent 1ab7d54 commit bd1cccc

File tree

3 files changed

+50
-46
lines changed

3 files changed

+50
-46
lines changed

.goreleaser.yaml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ version: 2
44

55
builds:
66
# Build configuration for darwin and linux
7-
- id: default
7+
- id: linux
88
ldflags: &ldflags
99
- -s -w -X github.com/gtsteffaniak/hi-time-live/routes.Version={{.Version}}
1010
main: main.go
1111
binary: filebrowser
1212
goos:
13-
- darwin
1413
- linux
1514
goarch:
1615
- amd64
@@ -36,8 +35,24 @@ builds:
3635
post:
3736
- upx {{ .Path }} # Compress the binary with UPX
3837

38+
# Build configuration for windows without arm & upx
39+
- id: windows
40+
ldflags: *ldflags
41+
main: main.go
42+
binary: filebrowser
43+
goos:
44+
- darwin
45+
goarch:
46+
- amd64
47+
- arm64
48+
3949
archives:
40-
- name_template: "{{.Os}}-{{.Arch}}{{if .Arm}}v{{.Arm}}{{end}}-{{ .ProjectName }}"
50+
- name_template: >
51+
{{- if eq .Os "windows" -}}
52+
{{.ProjectName}}
53+
{{- else -}}
54+
{{.Os}}-{{.Arch}}{{if .Arm}}v{{.Arm}}{{end}}-{{.ProjectName}}
55+
{{- end -}}
4156
format: binary
4257
4358
checksum:

templates/css/roomStyle.css

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
/* Main container spans the full viewport */
6262
#video-container {
6363
display: grid;
64-
grid-template-columns: repeat(1, 1fr) !important; /* Two columns */
64+
grid-template-columns: repeat(1, 1fr); /* one columns */
6565
gap: 1em; /* Spacing between grid items */
6666
box-sizing: border-box; /* Includes padding/border in dimensions */
6767
overflow: hidden; /* Prevents any overflow */
@@ -76,22 +76,12 @@
7676
padding-bottom: 5em !important;
7777
}
7878

79-
.four {
80-
grid-template-columns: repeat(2, 1fr) !important; /* Two columns */
81-
}
82-
83-
/* Medium screens - 2x2 layout */
84-
@media (min-width: 801px) and (max-width: 1200px) {
85-
#video-container {
86-
grid-template-columns: repeat(2, 1fr); /* Two columns */
87-
}
79+
.one {
80+
grid-template-columns: repeat(1, 1fr) !important; /* One column */
8881
}
8982

90-
/* Large screens - 3x1 or 3x2 layout */
91-
@media (min-width: 1201px) {
92-
#video-container {
93-
grid-template-columns: repeat(3, 1fr); /* Three columns */
94-
}
83+
.two {
84+
grid-template-columns: repeat(2, 1fr) !important; /* Two columns */
9585
}
9686

9787
/* Styling for each video container */

templates/js/signaling.js

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -78,35 +78,18 @@ async function createRemoteVideoStream(id) {
7878
}
7979

8080
// Helper function to attach media stream to the video element
81-
function attachMediaStream(video, stream, id) {
81+
async function attachMediaStream(video, stream, id) {
8282
try {
83+
const overlay = document.getElementById(id + '-video-overlay');
8384
// Use Safari-friendly attachment logic
8485
video.srcObject = stream;
85-
video.addEventListener("loadedmetadata", async () => {
86-
try {
87-
await video.play(); // Ensure video playback starts
88-
console.log("Remote video is playing for:", id);
89-
video.muted = false; // Unmute after video starts
90-
} catch (playError) {
91-
console.error("Error playing the remote video:", playError);
92-
93-
// Optional: Add a fallback for user interaction
94-
const overlay = document.getElementById(id + '-video-overlay');
95-
overlay.innerHTML += "<p>Click to play</p>";
96-
overlay.style.cursor = "pointer";
97-
98-
overlay.addEventListener("click", async () => {
99-
try {
100-
overlay.style.display = "none"; // Hide the overlay
101-
await video.play();
102-
console.log("Remote video resumed after user interaction:", id);
103-
video.muted = false;
104-
} catch (interactionError) {
105-
console.error("Error playing the video after user interaction:", interactionError);
106-
}
107-
});
108-
}
109-
});
86+
try {
87+
await video.play(); // Ensure video playback starts
88+
console.log("Remote video is playing for:", id);
89+
video.muted = false; // Unmute after video starts
90+
} catch (playError) {
91+
console.error("Error playing the remote video:", playError);
92+
}
11093
updateContainerClass();
11194
} catch (error) {
11295
console.error("Error attaching media stream:", error);
@@ -116,6 +99,9 @@ function attachMediaStream(video, stream, id) {
11699
function updateContainerClass() {
117100
const videoContainer = document.getElementById('video-container');
118101
const childrenCount = videoContainer.children.length;
102+
videoContainer.classList.remove('one');
103+
videoContainer.classList.remove('two');
104+
119105
if (childrenCount > 0) {
120106
videoContainer.classList.remove('hidden');
121107
if (window.innerWidth > 800) {
@@ -125,13 +111,26 @@ function updateContainerClass() {
125111
} else {
126112
videoContainer.classList.add('hidden');
127113
}
128-
if (childrenCount === 4) {
129-
videoContainer.classList.add('four');
114+
if (childrenCount === 1) {
115+
videoContainer.classList.add('one');
116+
return;
117+
}
118+
if (childrenCount === 2) {
119+
if (window.innerWidth > 800) {
120+
videoContainer.classList.add('two');
121+
} else {
122+
videoContainer.classList.add('one');
123+
}
124+
}
125+
if (childrenCount === 4 || childrenCount === 3) {
126+
videoContainer.classList.add('two');
130127
return;
131128
}
132129
}
133130

134131

132+
window.addEventListener("resize", updateContainerClass);
133+
135134
function removeRemoteVideoStream(id) {
136135
const containerDiv = document.getElementById(id + '-container');
137136
if (containerDiv) {

0 commit comments

Comments
 (0)