Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
cvh-camera
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Simon Döring
cvh-camera
Commits
fcd22690
Commit
fcd22690
authored
Dec 29, 2020
by
Simon Döring
Browse files
Options
Downloads
Patches
Plain Diff
Change sender room to be selected through query string
parent
9bf98fac
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
sender/camera-sender.html
+1
-8
1 addition, 8 deletions
sender/camera-sender.html
sender/camera-sender.js
+86
-78
86 additions, 78 deletions
sender/camera-sender.js
with
87 additions
and
86 deletions
sender/camera-sender.html
+
1
−
8
View file @
fcd22690
...
...
@@ -8,17 +8,10 @@
<link
rel=
"stylesheet"
href=
"camera-sender.css"
>
</head>
<body>
<h3
id=
"room-indicator"
></h3>
<div>
Leave the pin empty if the rooms has none set.
</div>
<select
id=
"room-select"
>
<option
value=
"1001"
>
VNC 1
</option>
<option
value=
"1002"
>
VNC 2
</option>
<option
value=
"1003"
>
VNC 3
</option>
<option
value=
"1004"
>
VNC 4
</option>
<option
value=
"1005"
>
VNC 5
</option>
<option
value=
"1006"
>
VNC 6
</option>
</select>
<select
id=
"res-select"
>
<option
value=
"lowres"
>
320x240
</option>
<option
value=
"lowres-16:9"
>
320x180
</option>
...
...
This diff is collapsed.
Click to expand it.
sender/camera-sender.js
+
86
−
78
View file @
fcd22690
document
.
addEventListener
(
'
DOMContentLoaded
'
,
function
()
{
var
server
=
'
https://
'
+
window
.
location
.
hostname
+
'
:8089/janus
'
;
var
janus
=
null
;
...
...
@@ -5,16 +6,13 @@ var videoroomHandle = null;
var
room
=
1006
;
var
sendResolution
=
'
stdres
'
;
var
startButton
=
null
;
var
stopButton
=
null
;
// const socketNumber = room + 4000;
const
socketNumber
=
5006
;
const
socketNumber
=
room
+
4000
;
const
socket
=
io
(
'
https://
'
+
window
.
location
.
hostname
,
{
path
:
'
/socket.io/
'
+
socketNumber
});
document
.
addEventListener
(
'
DOMContentLoaded
'
,
function
()
{
startButton
=
document
.
getElementById
(
'
start
'
);
stopButton
=
document
.
getElementById
(
'
stop
'
);
var
startButton
=
document
.
getElementById
(
'
start
'
);
var
stopButton
=
document
.
getElementById
(
'
stop
'
);
parseRoomFromURL
();
Janus
.
init
({
debug
:
'
all
'
,
callback
:
function
()
{
if
(
!
Janus
.
isWebrtcSupported
())
{
...
...
@@ -32,17 +30,14 @@ document.addEventListener('DOMContentLoaded', function() {
Janus
.
log
(
'
Plugin attached! (
'
+
videoroomHandle
.
getPlugin
()
+
'
, id=
'
+
videoroomHandle
.
getId
()
+
'
)
'
);
startButton
.
onclick
=
function
()
{
var
roomSelect
=
document
.
getElementById
(
'
room-select
'
);
var
resSelect
=
document
.
getElementById
(
'
res-select
'
);
var
pinInput
=
document
.
getElementById
(
'
pin-input
'
);
startButton
.
setAttribute
(
'
disabled
'
,
''
);
roomSelect
.
setAttribute
(
'
disabled
'
,
''
);
resSelect
.
setAttribute
(
'
disabled
'
,
''
);
stopButton
.
removeAttribute
(
'
disabled
'
);
stopButton
.
onclick
=
function
()
{
janus
.
destroy
();
};
room
=
parseInt
(
roomSelect
.
value
);
sendResolution
=
resSelect
.
value
;
Janus
.
log
(
'
sendResolution:
'
,
sendResolution
);
shareCamera
(
pinInput
.
value
);
...
...
@@ -70,8 +65,6 @@ document.addEventListener('DOMContentLoaded', function() {
if
(
document
.
getElementById
(
'
camera-preview
'
)
==
null
)
{
var
video
=
document
.
createElement
(
'
video
'
);
video
.
setAttribute
(
'
id
'
,
'
camera-preview
'
);
video
.
setAttribute
(
'
width
'
,
'
100%
'
);
video
.
setAttribute
(
'
height
'
,
'
100%
'
);
video
.
setAttribute
(
'
autoplay
'
,
''
);
video
.
setAttribute
(
'
playsinline
'
,
''
);
video
.
setAttribute
(
'
muted
'
,
'
muted
'
);
...
...
@@ -97,7 +90,6 @@ document.addEventListener('DOMContentLoaded', function() {
}
});
}});
},
false
);
function
shareCamera
(
pin
)
{
var
register
=
{
...
...
@@ -167,3 +159,19 @@ function handleMessage(msg, jsep) {
videoroomHandle
.
handleRemoteJsep
({
jsep
});
}
};
function
parseRoomFromURL
()
{
var
urlParams
=
new
URLSearchParams
(
window
.
location
.
search
);
var
roomParam
=
urlParams
.
get
(
'
room
'
);
var
roomIndicator
=
document
.
getElementById
(
'
room-indicator
'
);
var
appendix
=
''
;
if
(
roomParam
!=
null
&&
!
isNaN
(
roomParam
))
{
room
=
parseInt
(
roomParam
);
}
else
{
console
.
log
(
'
Got no valid room in URL search params, using default room
'
+
room
);
appendix
=
'
(Default value)
'
;
}
roomIndicator
.
innerText
=
`VNC
${
room
-
1000
}
- Room
${
room
}
`
+
appendix
;
}
},
false
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment