Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-web-393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-web-393
Commits
5b87fb74
Commit
5b87fb74
authored
May 19, 2020
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added mjpeg playing in html canvas
parent
0e9e56d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
1 deletion
+71
-1
Makefile
src/index/Makefile
+2
-1
mjpeg.html
src/index/mjpeg.html
+69
-0
No files found.
src/index/Makefile
View file @
5b87fb74
...
...
@@ -3,7 +3,8 @@ OWN = -o root -g root
INSTDOCS
=
0644
INSTALL
=
install
DOCS
=
index.html
\
index.php
index.php
\
mjpeg.html
all
:
@
echo
"make all in src"
...
...
src/index/mjpeg.html
0 → 100644
View file @
5b87fb74
<html>
<head>
<style>
body
{
margin
:
0px
;
}
canvas
{
height
:
100%
;
border
:
0px
solid
red
;
}
</style>
</head>
<body>
<canvas
id=
'cnv'
></canvas>
<script>
const
IMGSRV_PORT0
=
2323
;
const
params
=
new
URLSearchParams
(
location
.
search
);
const
port
=
params
.
get
(
'port'
)
||
0
;
if
(
params
.
get
(
'port'
)
===
null
){
let
s
=
""
;
if
(
location
.
search
===
""
){
s
=
"?port="
+
port
;
}
else
{
s
=
location
.
search
+
"&port="
+
port
;
}
window
.
history
.
pushState
(
''
,
''
,
location
.
pathname
+
s
);
}
let
imgsrv_port
=
IMGSRV_PORT0
+
parseInt
(
port
);
let
cnv
=
document
.
getElementById
(
'cnv'
);
let
ctx
=
cnv
.
getContext
(
'2d'
);
let
img
=
new
Image
();
img
.
onload
=
function
()
{
canvas_resize
();
refreshCanvas
();
};
img
.
src
=
location
.
origin
+
":"
+
imgsrv_port
+
"/mimg"
;
window
.
addEventListener
(
"resize"
,
()
=>
{
canvas_resize
();
});
///////////////////////////////////////////////////////////////////////////////////
function
canvas_resize
(){
ctx
.
canvas
.
width
=
img
.
width
;
ctx
.
canvas
.
height
=
img
.
height
;
}
window
.
setInterval
(
"refreshCanvas()"
,
5
);
function
refreshCanvas
(){
try
{
ctx
.
drawImage
(
img
,
0
,
0
,
ctx
.
canvas
.
width
,
ctx
.
canvas
.
height
);
}
catch
(
err
){
img
.
src
=
location
.
origin
+
":2323/mimg"
;
}
};
</script>
</body>
</html>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment