I would like the volume level element to be expanded from the beginning, without mouse cursor hovering. I am about this element that is hidden by default:
I didn’t find any built-in option for it (strange enough). I’ve been trying to solve it with CSS, but without success.
There is a demo of problem in action that I’ve created for the question. The code is shown below:
JavaScript
x
34
34
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<meta charset="utf-8" />
5
<title>Volume Volume Expanded</title>
6
<link href="//vjs.zencdn.net/7.3.0/video-js.min.css" rel="stylesheet" />
7
<script src="//vjs.zencdn.net/7.3.0/video.min.js"></script>
8
</head>
9
<body>
10
<video
11
id="my-player"
12
class="video-js vjs-default-skin vjs-16-9 vjs-big-play-centered"
13
>
14
<source
15
src="https://bitdash-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8"
16
type="video/x-mpegURL"
17
/>
18
</video>
19
20
<script>
21
videojs("my-player", {
22
muted: true,
23
autoplay: true,
24
controls: true,
25
controlBar: {
26
children: {
27
volumePanel: true
28
}
29
}
30
});
31
</script>
32
</body>
33
</html>
34
Advertisement
Answer
You could change the style of volume control
DEMO: https://codesandbox.io/s/videojs-volumelevel-show-forked-6bcc4l
JavaScript
1
8
1
.video-js .vjs-volume-panel .vjs-volume-control {
2
visibility: visible;
3
opacity: 100;
4
width: 5em;
5
height: 1px;
6
margin-left: -1px;
7
}
8