fenetre 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE.txt +21 -0
- data/README.md +98 -9
- data/app/assets/javascripts/fenetre/application.js +1 -14
- data/app/assets/javascripts/fenetre/controllers/index.js +1 -19
- data/app/assets/javascripts/fenetre/controllers/video_chat_controller.js +556 -516
- data/app/assets/javascripts/fenetre/vendor/stimulus.js +2567 -0
- data/app/assets/javascripts/fenetre/vendor/stimulus.min.js +5 -2588
- data/app/assets/javascripts/fenetre.js +12 -8
- data/app/assets/javascripts/stimulus/stimulus.min.js +5 -2588
- data/app/assets/stylesheets/fenetre/video_chat.css +218 -157
- data/app/channels/fenetre/video_chat_channel.rb +69 -111
- data/app/controllers/fenetre/status_controller.rb +13 -0
- data/app/helpers/fenetre/video_chat_helper.rb +54 -32
- data/app/javascript/controllers/fenetre/video_chat_controller.js +1 -662
- data/config/importmap/fenetre.rb +4 -0
- data/config/importmap.rb +7 -21
- data/config/routes.rb +6 -0
- data/lib/fenetre/engine.rb +4 -167
- data/lib/fenetre/parallel_formatter.rb +25 -0
- data/lib/fenetre/presence.rb +34 -0
- data/lib/fenetre/version.rb +1 -1
- data/lib/fenetre.rb +40 -2
- metadata +25 -42
- data/Rakefile +0 -33
- data/app/javascript/test/test_runner.js +0 -15
- data/app/javascript/test/video_chat_controller_test.js +0 -215
- data/lib/fenetre/video_chat_channel.rb +0 -36
- data/lib/tasks/javascript_test.rake +0 -69
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Fenetre
|
|
4
|
+
class StatusController < ActionController::Base
|
|
5
|
+
def show
|
|
6
|
+
render json: { status: 'ok', time: Time.now.utc.iso8601, version: Fenetre::VERSION }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def human
|
|
10
|
+
render html: helpers.content_tag(:h1, "Fenetre Status: ok (#{Fenetre::VERSION})")
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -3,43 +3,49 @@
|
|
|
3
3
|
module Fenetre
|
|
4
4
|
module VideoChatHelper
|
|
5
5
|
# Helper method to render the video chat container with proper data attributes
|
|
6
|
-
def fenetre_video_chat_container(room_id, user_id, theme: 'dark')
|
|
6
|
+
def fenetre_video_chat_container(room_id, user_id, theme: 'dark', ice_servers: nil)
|
|
7
7
|
content = stylesheet_link_tag('fenetre/video_chat', media: 'all')
|
|
8
|
-
|
|
9
|
-
content + js + video_chat_main_container(room_id, user_id, theme)
|
|
8
|
+
content + video_chat_main_container(room_id, user_id, theme, ice_servers)
|
|
10
9
|
end
|
|
11
10
|
|
|
12
11
|
private
|
|
13
12
|
|
|
14
|
-
def video_chat_main_container(room_id, user_id, theme)
|
|
13
|
+
def video_chat_main_container(room_id, user_id, theme, ice_servers)
|
|
14
|
+
servers = ice_servers || Fenetre.ice_servers
|
|
15
15
|
content_tag(:div, class: "fenetre-video-chat-container fenetre-theme-#{theme}", data: {
|
|
16
16
|
controller: 'fenetre--video-chat',
|
|
17
|
-
|
|
17
|
+
fenetre__video_chat_user_id_value: user_id.to_s,
|
|
18
|
+
fenetre__video_chat_ice_servers_value: servers,
|
|
19
|
+
fenetre__video_chat_max_video_bitrate_value: Fenetre.max_video_bitrate,
|
|
20
|
+
fenetre__video_chat_max_audio_bitrate_value: Fenetre.max_audio_bitrate,
|
|
21
|
+
fenetre__video_chat_video_width_value: Fenetre.video_width,
|
|
22
|
+
fenetre__video_chat_video_height_value: Fenetre.video_height,
|
|
23
|
+
fenetre__video_chat_frame_rate_value: Fenetre.frame_rate,
|
|
18
24
|
fenetre_theme: theme
|
|
19
25
|
}) do
|
|
20
26
|
hidden_room_id_input(room_id) +
|
|
21
27
|
connection_status_indicator +
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
local_video_section +
|
|
28
|
+
content_tag(:div, class: 'fenetre-stage') do
|
|
29
|
+
local_video_section + remote_videos_section
|
|
30
|
+
end +
|
|
26
31
|
media_control_section +
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
content_tag(:div, class: 'fenetre-sidebar') do
|
|
33
|
+
section_heading('Participants') +
|
|
34
|
+
participants_list +
|
|
35
|
+
section_heading('Chat') +
|
|
36
|
+
chat_section
|
|
37
|
+
end
|
|
31
38
|
end
|
|
32
39
|
end
|
|
33
40
|
|
|
34
|
-
# Add connection status indicator
|
|
35
41
|
def connection_status_indicator
|
|
36
42
|
content_tag(:div, 'Connecting...',
|
|
37
43
|
class: 'fenetre-connection-status',
|
|
38
|
-
data: {
|
|
44
|
+
data: { fenetre__video_chat_target: 'connectionStatus' })
|
|
39
45
|
end
|
|
40
46
|
|
|
41
47
|
def hidden_room_id_input(room_id)
|
|
42
|
-
content_tag(:input, nil, type: 'hidden', value: room_id, data: {
|
|
48
|
+
content_tag(:input, nil, type: 'hidden', value: room_id, data: { fenetre__video_chat_target: 'roomId' })
|
|
43
49
|
end
|
|
44
50
|
|
|
45
51
|
def section_heading(text)
|
|
@@ -47,31 +53,41 @@ module Fenetre
|
|
|
47
53
|
end
|
|
48
54
|
|
|
49
55
|
def participants_list
|
|
50
|
-
content_tag(:ul, '',
|
|
56
|
+
content_tag(:ul, '', class: 'fenetre-participant-list', data: { fenetre__video_chat_target: 'participants' })
|
|
51
57
|
end
|
|
52
58
|
|
|
53
59
|
def local_video_section
|
|
54
|
-
content_tag(:div, class: 'fenetre-video-section') do
|
|
55
|
-
content_tag(:video, '',
|
|
56
|
-
|
|
60
|
+
content_tag(:div, class: 'fenetre-video-section fenetre-local-section') do
|
|
61
|
+
content_tag(:video, '',
|
|
62
|
+
data: { fenetre__video_chat_target: 'localVideo' },
|
|
63
|
+
autoplay: true,
|
|
64
|
+
playsinline: true,
|
|
65
|
+
muted: true,
|
|
66
|
+
class: 'fenetre-local-video')
|
|
57
67
|
end
|
|
58
68
|
end
|
|
59
69
|
|
|
60
70
|
def media_control_section
|
|
61
|
-
content_tag(:div, class: 'fenetre-controls') do
|
|
62
|
-
toggle_button('
|
|
63
|
-
toggle_button('
|
|
64
|
-
toggle_button('Share Screen', 'toggleScreenShare')
|
|
71
|
+
content_tag(:div, class: 'fenetre-controls', role: 'toolbar', 'aria-label': 'Call controls') do
|
|
72
|
+
toggle_button('Camera', 'toggleVideo', 'Turn off camera') +
|
|
73
|
+
toggle_button('Mic', 'toggleAudio', 'Mute microphone') +
|
|
74
|
+
toggle_button('Share Screen', 'toggleScreenShare', 'Share screen')
|
|
65
75
|
end
|
|
66
76
|
end
|
|
67
77
|
|
|
68
|
-
def toggle_button(label, action)
|
|
69
|
-
content_tag(:button, label,
|
|
78
|
+
def toggle_button(label, action, aria_label = nil)
|
|
79
|
+
content_tag(:button, label,
|
|
80
|
+
type: 'button',
|
|
81
|
+
data: { action: "fenetre--video-chat##{action}" },
|
|
82
|
+
class: 'fenetre-control-button',
|
|
83
|
+
'aria-label': aria_label || label,
|
|
84
|
+
'aria-pressed': 'false')
|
|
70
85
|
end
|
|
71
86
|
|
|
72
87
|
def remote_videos_section
|
|
73
|
-
content_tag(:div, class: 'fenetre-video-section') do
|
|
74
|
-
content_tag(:div, '', data: {
|
|
88
|
+
content_tag(:div, class: 'fenetre-video-section fenetre-remote-section') do
|
|
89
|
+
content_tag(:div, '', data: { fenetre__video_chat_target: 'remoteVideos' },
|
|
90
|
+
class: 'fenetre-remote-grid')
|
|
75
91
|
end
|
|
76
92
|
end
|
|
77
93
|
|
|
@@ -82,14 +98,20 @@ module Fenetre
|
|
|
82
98
|
end
|
|
83
99
|
|
|
84
100
|
def chat_messages
|
|
85
|
-
content_tag(:div, '', data: {
|
|
101
|
+
content_tag(:div, '', data: { fenetre__video_chat_target: 'chatMessages' }, class: 'fenetre-chat-messages')
|
|
86
102
|
end
|
|
87
103
|
|
|
88
104
|
def chat_input_container
|
|
89
105
|
content_tag(:div, class: 'fenetre-chat-input-container') do
|
|
90
|
-
content_tag(:input, nil, type: 'text', placeholder: '
|
|
91
|
-
|
|
92
|
-
|
|
106
|
+
content_tag(:input, nil, type: 'text', placeholder: 'Message the room…',
|
|
107
|
+
maxlength: 2000,
|
|
108
|
+
autocomplete: 'off',
|
|
109
|
+
data: {
|
|
110
|
+
fenetre__video_chat_target: 'chatInput',
|
|
111
|
+
action: 'keydown.enter->fenetre--video-chat#sendChat'
|
|
112
|
+
}) +
|
|
113
|
+
content_tag(:button, 'Send', type: 'button',
|
|
114
|
+
data: { action: 'fenetre--video-chat#sendChat' },
|
|
93
115
|
class: 'fenetre-chat-send-button')
|
|
94
116
|
end
|
|
95
117
|
end
|