Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 9 of 9
  1. #1
    Senior Member Apesbrain's Avatar
    Join Date
    Jun 2005
    Location
    East Coast, USA
    Posts
    1,105

    Add volume control to "nowplaying.html"

    Is this possible and, if so, can you give me a hint on how it might be done? I'm looking for a control that would show current volume ("Vol: 72") and have a "+" and "-" button. Thanks.

  2. #2
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    19,779

    Add volume control to "nowplaying.html"

    > Is this possible and, if so, can you give me a hint on how it might be
    > done? I'm looking for a control that would show current volume ("Vol:
    > 72") and have a "+" and "-" button. Thanks.


    There's no nowplaying.html in LMS?

    But if you look at the default skin, then you'll see there are
    components to show volume up/down and a bar:

    https://github.com/Logitech/slimserv...l/Main.js#L248



    --

    Michael

  3. #3
    Senior Member Apesbrain's Avatar
    Join Date
    Jun 2005
    Location
    East Coast, USA
    Posts
    1,105
    Quote Originally Posted by mherger View Post
    There's no nowplaying.html in LMS?
    Correct, it came from someone else's work uploaded here in the forum. Working with those controls you linked is doing the trick. Thanks!

  4. #4
    Senior Member Apesbrain's Avatar
    Join Date
    Jun 2005
    Location
    East Coast, USA
    Posts
    1,105
    I'd like to bind the "Up" and "Down" keyboard arrow keys to Squeezebox volume. There is a javascript library called Mousetrap that will enable this: https://craig.is/killing/mice

    The code should look something like this:

    Code:
    <script type="text/javascript" src="/html/ext/mousetrap.js">
    	//Keyboard actions
    	Mousetrap.bind ('up', function() { volumeup; });
    	Mousetrap.bind ('down', function() { volumedown; });
    </script>
    But I don't know enough to get it to work. What functions should I be calling? Thanks for any suggestions.

  5. #5
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    19,779

    Add volume control to "nowplaying.html"

    > But I don't know enough to get it to work. What functions should I be
    > calling? Thanks for any suggestions.


    SqueezeJS.Controller.setVolume(1, '+')

    Or '-', obviously. The number defines how many steps you want to
    increase it (volume goes from 0 - 100).

    But TBH: I'm not sure whether this will work. Just give it a try and let
    us know what it gives. Check the browser's error console while playing
    with this.

    --

    Michael

  6. #6
    Senior Member Apesbrain's Avatar
    Join Date
    Jun 2005
    Location
    East Coast, USA
    Posts
    1,105
    Thanks Michael. This code works in Chrome:

    Code:
    <script type="text/javascript" src="/html/ext/mousetrap.js"></script>
    <script type="text/javascript">
    	Mousetrap.bind ('up', function() {SqueezeJS.Controller.setVolume(0.5, '+')});
    	Mousetrap.bind ('down', function() {SqueezeJS.Controller.setVolume(0.5, '-')});
    </script>
    Can you tell me the equivalent SqueezeJS commands for "pause", "play", "previous", and "next"?

  7. #7
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    19,779

    Add volume control to "nowplaying.html"

    > Can you tell me the equivalent SqueezeJS commands for "pause" and
    > "play"?


    SqueezeJS.Controller.playerControl(['play']) etc. You can basically use
    any CLI command calling playerControl().

    --

    Michael

  8. #8
    Senior Member Apesbrain's Avatar
    Join Date
    Jun 2005
    Location
    East Coast, USA
    Posts
    1,105
    Quote Originally Posted by mherger View Post
    > Can you tell me the equivalent SqueezeJS commands for "pause" and
    > "play"?


    SqueezeJS.Controller.playerControl(['play']) etc. You can basically use
    any CLI command calling playerControl().

    --

    Michael
    Have tried the code below but 'back' and 'next' do not work. Am I using the correct commands? Thanks.

    Code:
    <script type="text/javascript" src="/html/ext/mousetrap.js"></script>
    <script type="text/javascript">
    	Mousetrap.bind ('up', function() {SqueezeJS.Controller.setVolume(0.5, '+')});
    	Mousetrap.bind ('down', function() {SqueezeJS.Controller.setVolume(0.5, '-')});
    	Mousetrap.bind ('left', function() {SqueezeJS.Controller.playerControl(['back'])});
    	Mousetrap.bind ('right', function() {SqueezeJS.Controller.playerControl(['next'])});
    	Mousetrap.bind ('space', function() {SqueezeJS.Controller.playerControl(['pause'])});
    </script>
    The "Help" link at bottom of web GUI is not working for me (Logitech Media Server Version: 7.9.1 - 1503129892 @ Sat Aug 19 08:18:19 CUT 2017).

  9. #9
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    19,779

    Add volume control to "nowplaying.html"

    > Have tried the code below but 'back' and 'next' do not work. Am I using
    > the correct commands? Thanks.


    If you can't find them in the CLI documentation, then they're not correct.

    http://htmlpreview.github.io/?https:...s/cli-api.html

    Use "playlist index +1" or ".. -1" respectively instead.


    --

    Michael

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •