Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 4 of 4
  1. #1
    Junior Member
    Join Date
    Dec 2016
    Posts
    15

    Right way to do custom playback controls?

    I'm trying to build a plugin for podcast playback, and I have most of the streaming, menu construction, etc. done (based on Slim::Plugin::OPMLBased).

    As a part of this I'd like to be able to offer 30s skip features. The plugin function to actually jump position is straightforward, but I haven't been able to figure out how to wire it up in the web UI as well as other control surfaces.

    What I think I know:

    - Looking at other plugins, like Pandora, I see that its possible to replace the repeat/shuffle buttons for a particular song with custom code in getMetadataFor(). This seems useful, but doesn't appear to apply to anything other than the default web skin, correct? In particular it doesn't seem to change the Material Skin I prefer to use?

    - Slim::Hardware::IR probably gets me IR remote control, but its not song-specific like getMetadataFor(). It's also mode-specific, and I'm not sure I should be modifying the mappings for most modes. For example, when the podcast is playing the client mode is "INPUT.List". Conflicts seem likely.

    Neither of these approaches seem to work with mobile app controls (Squeezer) or Material Skin.

    Looking for other options I tried to patch into the default 'rew' and 'fwd' commands via Slim::Buttons::Common::setFunction(), but those functions don't actually appear on the callpath from the web controls as far as I can tell.

    What's the right way to do this? I'm fine with a skip button in the web UI and IR control, but I'd like to be less skin specific. I'm also happy to override rew/fwd if that's a more central location, with the understanding it would need to be an option for users since it's a change in default behavior for those buttons.

    Thanks for any help...

  2. #2
    Senior Member
    Join Date
    Mar 2017
    Posts
    1,325
    Quote Originally Posted by AxxelH View Post
    I'm trying to build a plugin for podcast playback, and I have most of the streaming, menu construction, etc. done (based on Slim::Plugin::OPMLBased).

    As a part of this I'd like to be able to offer 30s skip features. The plugin function to actually jump position is straightforward, but I haven't been able to figure out how to wire it up in the web UI as well as other control surfaces.
    Material already has (as of 1.2.0) a skip back/forward function - long press on the prev/next buttons will skip by a configured amount.

    Quote Originally Posted by AxxelH View Post
    - Looking at other plugins, like Pandora, I see that its possible to replace the repeat/shuffle buttons for a particular song with custom code in getMetadataFor(). This seems useful, but doesn't appear to apply to anything other than the default web skin, correct? In particular it doesn't seem to change the Material Skin I prefer to use?
    Material does change the repeat/skip buttons for pandora - but it looks for thumbsUp/thumbsDown explicitly for this. I could change it to look for others, but as stated the longpress on the prev/next buttons will do the skip you are looking for.
    Last edited by cpd73; 2019-12-18 at 01:16.

  3. #3
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    18,046
    The "normal" way to do playback action ffw/rew, knob rotate etc when you have a protocol handler defined for the audio format - is to use the canDoAction routine (I think you also need to implement canSeek) . LMS deliver the desired action (e.g. ffw, rew. pause,stop) to the protocol handler -

    Using these routine means no need for plugin to "know" about the UI - LMS handles them all

    Be careful about overloading some controls - as interaction with other plugins /controls can confuse users.

    I think your understanding of getmetadatafor may be a little incorrect. It is called by LMS whenever it needs metadata for a "song"/track (which can be a stream) to be displayed - this is usually playing but can also be when it is in a playlist. I think you may have trouble if you put IR code in getmetadatafor with a user with a playlist of podcasts.
    Last edited by bpa; 2019-12-18 at 00:49.

  4. #4
    Junior Member
    Join Date
    Dec 2016
    Posts
    15
    I could change it to look for others, but as stated the longpress on the prev/next buttons will do the skip you are looking for.
    Thanks, good to know, though that means I still need a solution for other control surfaces. What I think I want is something like the SongScanner plugin that works across multiple UIs.

    The "normal" way to do playback action ffw/rew, knob rotate etc when you have a protocol handler defined for the audio format - is to use the canDoAction routine (I think you also need to implement canSeek) . LMS deliver the desired action (e.g. ffw, rew. pause,stop) to the protocol handler -
    Understood, and I have all this wired up. What I want is to add is controls that trigger LMS to do in-song seeks, creating the content offsets that can then be handled by my protocol handler.

    Be careful about overloading some controls - as interaction with other plugins /controls can confuse users.
    My intention is for this to be optional, controlled from a plugin setting, but its something I would use. I'd like to use separate controls, but it seems like that's just not possible without coordination across all the different UIs and skins.

    The solution I have now is to declare a mode with button functions for rwd/fwd that point at my custom code. I finally figured out that 'jump' is required as well. This seems to catch most of the interesting control surfaces. I can then push the mode in a Slim::Control::Request for newsong if the URL is from the plugin. The mode pop happens when its not my url (or pause or stop).

    This seems to work as I hoped, even if it doesn't offer separate UI.

Posting Permissions

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