Giter VIP home page Giter VIP logo

Comments (8)

Riesi avatar Riesi commented on August 24, 2024

Have you set the option before or after .play()? Because it works fine, if I set it before playing. Probably does not apply after playing the track.

from mplayer.

gabrielstuff avatar gabrielstuff commented on August 24, 2024

from mplayer.

Riesi avatar Riesi commented on August 24, 2024

Look at my last solution! Not this one!
Ok I don't know why it worked at first or if I got confused with other tests. Now it was also broken for me. Anyways...
The problem it seems is that the varargs do not work. Due to this the length of the argument is always 0/undefined so the length check fails everytime.

My Solution (dirty fix):

Pass the arguments as an array:

  • .setOptions(['loop 0','speed 2'])//multiple args
  • .setOptions('loop 0')//single arg

And modify the line with 'set_property' in the setOptions function inside the index.js to:

  • this.player.cmd('set_property', value);//[key, value] old code

Beware that the changes might get overwritten by npm after an other installations. So copy the mplayer folder into the project root and use the following instead:

  • require('./mplayer'); //for local module

This solution is not really elegant compared to the one of noodny's, but it ain't broken for me.
Maybe he could tell us why it does not work anymore. Could be a problem with lodash, but its just a bad guess.
I also tried to set 'loop 0' after the start of the track and it works as long as it is still playing!
I hope this works for you!

from mplayer.

Riesi avatar Riesi commented on August 24, 2024

I figured the problem out, but I am at university without my laptop today. So I cant test it in Node. I coded in an online Js editor with my phone. So if you want the fix how it should have been in the first place wait until my new post! (in approximately 7h) πŸ˜€

from mplayer.

gabrielstuff avatar gabrielstuff commented on August 24, 2024

from mplayer.

Riesi avatar Riesi commented on August 24, 2024

Solution

Replace the setOptions function with the following. Now the function should work as expected!

setOptions: function(options) {
        if(options && Object.keys(options).length) {
            Object.keys(options).forEach(function(key) {
                this.player.cmd('set_property', [key, options[key]]);
            }.bind(this));
       }
  }

from mplayer.

hoetmaaiers avatar hoetmaaiers commented on August 24, 2024

I want to set the volume before executing player.openPlaylist(). Is this the same issue we are talking about in this issue? The only way for setting the volume seems to be after invoking openPlaylist with a timeout of 1000ms. There must be another way?

from mplayer.

Riesi avatar Riesi commented on August 24, 2024

It should probably work with this fix, because every function that sets any option uses setOption.
You can probably use openPlaylist(playlistfile, {volume:40}) to set the volume.
A more patched version of the player can be found at Technici4n/mplayer.
As long as noodny does not merge any pull requests.

from mplayer.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.