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.
@@ -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
- js = javascript_include_tag('fenetre.js', type: 'module')
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
- fenetre_video_chat_user_id_value: user_id.to_s,
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
- section_heading('Participants') +
23
- participants_list +
24
- section_heading('My Video') +
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
- section_heading('Remote Videos') +
28
- remote_videos_section +
29
- section_heading('Chat') +
30
- chat_section
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: { fenetre_video_chat_target: 'connectionStatus' })
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: { fenetre_video_chat_target: 'roomId' })
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, '', id: 'fenetre-participant-list')
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, '', data: { fenetre_video_chat_target: 'localVideo' }, autoplay: true, playsinline: true,
56
- muted: true, style: 'width: 200px; height: 150px;')
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('Toggle Video', 'toggleVideo') +
63
- toggle_button('Toggle Audio', 'toggleAudio') +
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, data: { action: "fenetre--video-chat##{action}" }, class: 'fenetre-control-button')
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: { fenetre_video_chat_target: 'remoteVideos' })
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: { fenetre_video_chat_target: 'chatMessages' }, class: 'fenetre-chat-messages')
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: 'Type your message...',
91
- data: { fenetre_video_chat_target: 'chatInput' }) +
92
- content_tag(:button, 'Send', data: { action: 'fenetre--video-chat#sendChat' },
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