Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I show current time, divider and duration using options? #8534

Open
vinixwu opened this issue Dec 28, 2023 · 4 comments · May be fixed by kerasus/soalaa#1735 or nerdy-tech-com-gitub/filebrowser#8
Labels
needs: triage This issue needs to be reviewed

Comments

@vinixwu
Copy link

vinixwu commented Dec 28, 2023

Description

I tried several approaches, but it seems the only way to display current time, divider and duration is to override related rules in video-js.css. I can only hide full screen and PIP toggle using setup options or code as the code examples listed in Guides.

I found some code examples on Stack Overflow to show current time, divider and duration using setup options, but they didn't work.

Is there a way to show/hide/enable/disable every item on the control bar using options or code?

Reduced test case

https://jsfiddle.net/24a3ujeb/

Steps to reproduce

  1. Setup video.js using options like { controlBar: { currentTimeDisplay: true } }
  2. The player didn't show current time.

Errors

No response

What version of Video.js are you using?

8.8.0

Video.js plugins used.

None

What browser(s) including version(s) does this occur with?

Chrome 120.0.6099.129

What OS(es) and version(s) does this occur with?

Windows 11 Pro 23H2

@vinixwu vinixwu added the needs: triage This issue needs to be reviewed label Dec 28, 2023
Copy link

welcome bot commented Dec 28, 2023

👋 Thanks for opening your first issue here! 👋

If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.

@bonniesimon
Copy link

The following worked for me:

{
  controlBar: {
    children: [
      // ...other options
      "currentTimeDisplay",
      "timeDivider",
      "durationDisplay",
      "pictureInPictureToggle",
      "playbackRateMenuButton",
      "fullscreenToggle",
    ],
  },
}

@sugar258596
Copy link

May I ask if you have solved this problem now? I also encountered this problem, but I solved it through a simple method. I don't know if this method will cause a chain reaction, so I want to change the method

@peckeby
Copy link

peckeby commented Aug 15, 2024

Facing the same issue(((
Neither this works

controlBar: {
           children: [
             'playToggle',
             'currentTimeDisplay',
             'timeDivider',
             'durationDisplay',
             'remainingTimeDisplay',
             fullscreenAllowed ? 'fullscreenToggle' : '',
             'progressControl',
           ],
         },

Nor this

 controlBar: {
            pictureInPictureToggle: false,
            fullscreenToggle: fullscreenAllowed || false,
            volumePanel: false,
            currentTimeDisplay: true,
            remainingTimeDisplay: false,
            subtitlesButton: false,
            subsCapsButton: false,
          },

Only in the first case if I use remainingTimeDisplay instead of durationDisplay remaining time display is showed with "-".

adrums86 added a commit that referenced this issue Sep 9, 2024
## Description
Time controls continue to cause confusion as they are included by
default but hidden by default. e.g. #8534 Adding CSS to display them is
not intuitive.

## Specific Changes proposed
Changing the default styles would be problematic before a major version.
This PR proposes adding an optional `vjs-normalise-time-controls` class
a user can add to the player, as an opt in.

This will default all time controls to being shown, except when live
content is playing. Users would then have to remove the time controls in
player options, or with `hide()` or `dispose()`.

## Requirements Checklist
- [ ] Feature implemented / Bug fixed
- [ ] If necessary, more likely in a feature request than a bug fix
- [x] Change has been verified in an actual browser (Chrome, Firefox,
IE)
  - [ ] Unit Tests updated or fixed
  - [ ] Docs/guides updated
- [ ] Example created ([starter template on
JSBin](https://codepen.io/gkatsev/pen/GwZegv?editors=1000#0))
- [ ] Has no DOM changes which impact accessiblilty or trigger warnings
(e.g. Chrome issues tab)
  - [ ] Has no changes to JSDoc which cause `npm run docs:api` to error
- [ ] Reviewed by Two Core Contributors

Co-authored-by: Adam Waldron <acwald@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: triage This issue needs to be reviewed
Projects
None yet
4 participants