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

Keep the current volume level #4328

Closed
peter-gribanov opened this issue May 5, 2017 · 3 comments
Closed

Keep the current volume level #4328

peter-gribanov opened this issue May 5, 2017 · 3 comments

Comments

@peter-gribanov
Copy link

Description

It would be better keep current volume level.

Steps to reproduce

  1. Open sum video
  2. Change volume level
  3. Open other video

Results

Expected

Keep the volume level since the last modification

Actual

Volume level is 100%

Additional Information

Example solution for me:

var player = videojs('video-player', {}, function() {
    var volume = $.cookie('_player_volume');
    if (typeof volume != 'undefined') {
        this.volume(volume / 100);
    }
});

player.on('volumechange', function () {
    // save current volume in cookie
    var el = $(this.controlBar.volumeMenuButton.volumeBar.volumeLevel.el());
    var level = (el.width() / el.offsetParent().width()) * 100;
    $.cookie('_player_volume', level);
});
@hartman
Copy link
Contributor

hartman commented May 5, 2017

cookie's should be avoided for these kinds of things. localstorage is better. There is a plugin available on https://github.com/theonion/videojs-persistvolume that does this, but it probably should be cleaned up a bit.

Ideally, i think you'd want a more generalized concept of storing data for any type of plugin. It was on my personal todo list a while back, but never got around to it.

@peter-gribanov
Copy link
Author

@hartman this plugin is not work now 😕

@gkatsev
Copy link
Member

gkatsev commented May 8, 2017

There's apparently a PR that fixes the plugin: theonion/videojs-persistvolume#17. Looks like there's a fork that has the fixes: https://github.com/jbboehr/videojs-persistvolume (that fork is also what's available on npm).

Unfortunately, I don't think we're doing to be adding this back into core. We used to have this feature but it was removed a while ago.

@gkatsev gkatsev closed this as completed May 8, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants