How can I make a full progress bar of video vs v5?

I would like to change the videojs v5 control layout to make a full-width progress bar over an area vjs-control-barsimilar to a pre-v5 skin player.

Here is the v5 skin: enter image description here

And here is the pre-v5 skin. Pay attention to the full-width lane: enter image description here

How do I proceed? Do I need to modify the structure tree in a component, ProgressControlor can this be done only with CSS, with an existing ProgressControlcomponent?

, , CSS vjs-progress-control display flex block, initial inline, 100% (- ProgressControl). , , vjs-progress-control .


. , CSS:

.vjs-progress-control {  
  position: absolute;
  bottom: 26px; /* The height of the ControlBar minus 4px. */
  left: 0;
  right: 0;
  width: 100%;
  height: 10px; /* the height must be reduced from 30 to 10px in order to allow the buttons below (e.g. play) to be pushed */
}
.vjs-progress-holder {/* needed to have a real 100% width display. */
  margin-left: 0px;
  margin-right: 0px;
}

- , , .

+4
3

DEMO

  .vjs-fluid {
    overflow: hidden;
  }
  .vjs-control-bar {
    display: block;
  }
  .vjs-control {
    position: absolute;
  }
  .vjs-progress-control {
    bottom: 28px; left: 0;
    height: 10px;
    width:  100%;
  }
  .vjs-progress-holder  {
    position: absolute;
    left: 0; margin: 0;
    height: 8px; width:  100%;
  }
  .vjs-play-progress,
  .vjs-load-progress {
    height: 8px;
  }
  .vjs-play-progress:before {
    font-size: 12px; top: -2px; 
    text-shadow: 0 0 2px black 
  }
  .vjs-current-time {
    display: block;
    left: 35px;
  }
  .vjs-time-divider {
    position: absolute;
    display: block;
    left: 70px;
  }
  .vjs-remaining-time {
    display: none;   
  }
  .vjs-duration {
    display: block;
    left: 70px;
  }
  .vjs-volume-menu-button {
    position: absolute;
    bottom: 0; right: 55px;
  }
  .vjs-playback-rate {
    position: absolute;
    bottom: 0; right: 28px;
  }
  .vjs-fullscreen-control {
    position: absolute;
    bottom: 0; right: 0;
  }

- ,

+4
.video-js .vjs-progress-control {
    position:absolute;
    width: 100%;
    top:-.3em;
    height:3px;
    /* deal with resulting gap between progress control and control bar that
       is the result of the attempt to keep things "clickable" on the controls */
    background-color: #2B333F;
    background-color: rgba(43, 51, 63, 0.7);
}

.video-js .vjs-progress-holder {
    position:absolute;
    margin:0px;
    top:0%;
    width:100%;
}

, , , , :hover, video.js. css , .

+4

Here is the minimal custom skin (in scss) that shows the progress bar full width above the rest of the controls. This works with video.js 5.19.2

.video-js.vjs-custom-skin {
  .vjs-custom-control-spacer {
    display: flex;
    flex: 1 1 auto;
  }
  .vjs-time-divider {
    display: inherit;
  }
  .vjs-current-time {
    margin-left: 1em;
  }
  .vjs-current-time, .vjs-duration {
    display: inherit;
    padding: 0;
  }
  .vjs-remaining-time {
    display: none;
  }
  .vjs-play-progress:before {
    display: none;
  }
  .vjs-progress-control {
    position: absolute;
    left: 0;
    right: 0;
    width: 100%;
    height: .5em;
    top: -.5em;

    &:hover {
      height: 1.5em;
      top: -1.5em;
    }
  }
  .vjs-progress-holder {
    margin: 0;
    height: 100%;
  }
}
0
source

Source: https://habr.com/ru/post/1612411/


All Articles