Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
SHMCamStudio
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SexHackMe
SHMCamStudio
Commits
f4bddbcc
Commit
f4bddbcc
authored
Nov 09, 2024
by
Robocoders
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update stream.html and index.html for responsive video resizing in sidebar
parent
8136e978
Pipeline
#160
failed with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
71 deletions
+81
-71
index.html
templates/index.html
+48
-0
stream.html
templates/stream.html
+33
-71
No files found.
templates/index.html
View file @
f4bddbcc
...
...
@@ -294,4 +294,52 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
},
{
passive
:
false
});
</script>
</body>
</html>
<script>
const
sidebar
=
document
.
querySelector
(
'.sidebar'
);
const
resizeHandle
=
document
.
getElementById
(
'resize-handle'
);
const
buttonsContainer
=
document
.
querySelector
(
'.buttons-container'
);
const
containerWidth
=
document
.
querySelector
(
'.main-container'
).
clientWidth
;
function
adjustSidebarWidth
(
newWidth
)
{
sidebar
.
style
.
width
=
`
${
newWidth
}
px`
;
buttonsContainer
.
style
.
width
=
`
${
containerWidth
-
newWidth
}
px`
;
// Notify the iframe about the resize
var
iframe
=
document
.
querySelector
(
".video-container iframe"
);
if
(
iframe
)
{
iframe
.
contentWindow
.
postMessage
(
"resize"
,
"*"
);
}
}
let
isResizing
=
false
;
resizeHandle
.
addEventListener
(
'mousedown'
,
(
e
)
=>
{
isResizing
=
true
;
document
.
addEventListener
(
'mousemove'
,
handleMouseMove
);
document
.
addEventListener
(
'mouseup'
,
stopResize
);
});
function
handleMouseMove
(
e
)
{
if
(
!
isResizing
)
return
;
let
newWidth
=
e
.
clientX
;
// Limit sidebar width between 50px and 50% of screen
newWidth
=
Math
.
max
(
50
,
Math
.
min
(
newWidth
,
containerWidth
/
2
));
adjustSidebarWidth
(
newWidth
);
}
function
stopResize
()
{
isResizing
=
false
;
document
.
removeEventListener
(
'mousemove'
,
handleMouseMove
);
document
.
removeEventListener
(
'mouseup'
,
stopResize
);
}
// Prevent zoom on double-tap for mobile
document
.
addEventListener
(
'touchmove'
,
function
(
event
)
{
if
(
event
.
scale
!==
1
)
{
event
.
preventDefault
();
}
},
{
passive
:
false
});
</script>
</body>
</html>
templates/stream.html
View file @
f4bddbcc
...
...
@@ -14,103 +14,65 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
>
<title>
Stream Interface
</title>
<!-- Video.js CSS -->
<link
href=
"https://vjs.zencdn.net/7.20.3/video-js.css"
rel=
"stylesheet"
/>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<title>
Video Stream
</title>
<style>
body
{
body
,
html
{
margin
:
0
;
padding
:
0
;
background-color
:
#000
;
height
:
100%
;
overflow
:
hidden
;
}
#videoContainer
{
width
:
100%
;
height
:
100vh
;
background-color
:
#000
;
height
:
100%
;
}
/* Prevent text selection and touch callout */
body
{
-webkit-user-select
:
none
;
-webkit-touch-callout
:
none
;
user-select
:
none
;
video
{
width
:
100%
;
height
:
100%
;
object-fit
:
contain
;
}
</style>
</head>
<body>
<div
id=
"videoContainer"
>
<video
id=
"videoElement"
class=
"video-js vjs-default-skin"
controls
playsinline
width=
"100%"
height=
"100%"
>
<video
id=
"videoPlayer"
autoplay
muted
playsinline
>
<source
src=
"/video_feed"
type=
"video/mp4"
>
Your browser does not support the video tag.
</video>
</div>
<!-- Video.js library -->
<script
src=
"https://vjs.zencdn.net/7.20.3/video.min.js"
></script>
<script>
const
videoElement
=
document
.
getElementById
(
'videoElement'
);
window
.
onload
=
function
()
{
var
player
=
videojs
(
'videoElement'
,
{
html5
:
{
vhs
:
{
overrideNative
:
!
videojs
.
browser
.
IS_SAFARI
},
nativeAudioTracks
:
false
,
nativeVideoTracks
:
false
}});
player
.
src
({
src
:
'{{ stream_url }}'
,
type
:
'application/x-mpegURL'
});
player
.
play
();
};
var
player
=
videojs
(
'videoPlayer'
,
{
autoplay
:
true
,
muted
:
true
,
controls
:
true
,
fluid
:
true
,
responsive
:
true
});
// Function to handle resize
function
handleResize
()
{
var
videoContainer
=
document
.
getElementById
(
'videoContainer'
);
var
video
=
document
.
getElementById
(
'videoPlayer'
);
video
.
style
.
width
=
videoContainer
.
clientWidth
+
'px'
;
video
.
style
.
height
=
videoContainer
.
clientHeight
+
'px'
;
}
// Fullscreen on click
videoElement
.
addEventListener
(
'click'
,
()
=>
{
if
(
!
document
.
fullscreenElement
)
{
if
(
videoElement
.
requestFullscreen
)
{
videoElement
.
requestFullscreen
();
}
else
if
(
videoElement
.
mozRequestFullScreen
)
{
// Firefox
videoElement
.
mozRequestFullScreen
();
}
else
if
(
videoElement
.
webkitRequestFullscreen
)
{
// Chrome, Safari and Opera
videoElement
.
webkitRequestFullscreen
();
}
else
if
(
videoElement
.
msRequestFullscreen
)
{
// IE/Edge
videoElement
.
msRequestFullscreen
();
}
}
else
{
if
(
document
.
exitFullscreen
)
{
document
.
exitFullscreen
();
}
else
if
(
document
.
mozCancelFullScreen
)
{
// Firefox
document
.
mozCancelFullScreen
();
}
else
if
(
document
.
webkitExitFullscreen
)
{
// Chrome, Safari and Opera
document
.
webkitExitFullscreen
();
}
else
if
(
document
.
msExitFullscreen
)
{
// IE/Edge
document
.
msExitFullscreen
();
}
}
});
// Call handleResize initially and on window resize
handleResize
();
window
.
addEventListener
(
'resize'
,
handleResize
);
//
Prevent zoom
document
.
addEventListener
(
'touchmov
e'
,
function
(
event
)
{
if
(
event
.
scale
!==
1
)
{
event
.
preventDefault
();
//
Listen for messages from the parent window
window
.
addEventListener
(
'messag
e'
,
function
(
event
)
{
if
(
event
.
data
===
'resize'
)
{
handleResize
();
}
},
{
passive
:
false
}
);
},
false
);
</script>
</body>
</html>
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