GithubHelp home page GithubHelp logo

Comments (9)

chincheta0815 avatar chincheta0815 commented on August 29, 2024

As an addititon: iOS works as described here: https://developer.apple.com/documentation/webkit/wkusercontentcontroller/1537172-add

The user content controller uses this parameter to define a JavaScript function for your message handler in the page’s main content world. The name of this function is window.webkit.messageHandlers.<name>.postMessage(<messageBody>), where <name> corresponds to the value of this parameter. For example, if you specify the string MyFunction, the user content controller defines the window.webkit.messageHandlers.MyFunction.postMessage() function in JavaScript.

The that I use is "mskNative". But nothing happens.

from lms-material.

CDrummond avatar CDrummond commented on August 29, 2024

There is some code already for this, as I considered creating a Gtk version of melodeon - and Gtk uses WebKit.

To make this work you need to pass ?nativeColors=w. Material will then pass a string to this handler. This string has the format:

TYPE
KEY VALUE
KEY VALUE
...

e.g.

MATERIAL-STATUS
PLAYING false
VOLUME 50
COUNT 1
SHUFFLE 0
REPEAT 0
TITLE Waterloo
ARTIST ABBA
ALBUM Gold
DURATION 124.567
TIME 2.63773479652405
TRACKID 195

List of native params/functions(?) is:

  • nativeStatus playback status (as above)
  • nativeColors indicates colours used for top and bottom toolbars
  • nativePlayer current player name and ID
  • nativeUiChanges not supported for this method
  • nativeTheme
  • nativeCover
  • nativePlayerPower
  • nativeAccent
  • nativeTitlebar

from lms-material.

chincheta0815 avatar chincheta0815 commented on August 29, 2024

Wohoooo. There we go.

I could fetch nativeColors and nativeTheme!!! It was a little bit combersome not use a JSON string, but well...
WkWebKit in iOS really needs the handlers as written above...
I would try to add a "=json" or however that would be called, but I do not know whether that would be in your interest.
Another thing: I have to learn how to "pack" .js files before testing or is that not necessary?
Just tell me your thoughts and if you would like me to help.

Concerning the nativeColors I got: Is there a way or rule how I could get the respective "font color" and "markup font color" in addition to the top and bottom background?
I am referring here to the "white/grey" color of the font in dark styles and this "blueish" for active elements like the playing button (see https://github.com/CDrummond/lms-material/blob/master/screenshots/mobile-now-playing-small.png). I need these two values to change the colors in the gui...

Another issue would be to select for a dark or light status bar, but that's tricky in ios...

from lms-material.

CDrummond avatar CDrummond commented on August 29, 2024

This code was originally written for Melodeon, and I assumed string parsing would be quicker than having to call a json decoder each time. The problem with making it json is that I'd then need to add code to build the json, etc. and I'm not convinced its really worth it.

Sorry, no current way to get text colour - but both are actually hard-coded for dark/light, so you could just do that. nativeAccent can be used to get the accent colour.

from lms-material.

chincheta0815 avatar chincheta0815 commented on August 29, 2024

Thanks for that info. I got further...

Now it seems that nativeAccent is not working.
Is that only shown in special cases?

from lms-material.

CDrummond avatar CDrummond commented on August 29, 2024

nativeAccent is only invoked if accent colour is derived from current track. I'd probably just ignore this.

As everything else works, shall I close this?

from lms-material.

chincheta0815 avatar chincheta0815 commented on August 29, 2024

If you just give me a hint on what the AccentColor does as I was not able to figure that out. That would be great.
Nevertheless, I got all I need (so far) ;o)
Thank you very much.

from lms-material.

CDrummond avatar CDrummond commented on August 29, 2024

accentColor is only invoked if the accent/highlight colour is changed due to the current song cover. This was added, AFAIR, for Squeezelite-X

from lms-material.

CDrummond avatar CDrummond commented on August 29, 2024

Just to let you know, for 5.2.0 I'm adding the ability to set top and bottom padding for the page. e.g. for 32px top and 12px bottom you'd pass:

http://server:9000/material/?topPad=32&botPad=12

I've done this so that in my Android APK I can use all the screen - so in the notification (top) and navigation (bottom) areas. As MaterialSkin 5.2.0 will allow the user to have the now-playing backgound fill the whole screen.

Using this is also easier that detecting when Material changes the top/bottom toolbar colours and manually setting the OS areas to the required colour.

from lms-material.

Related Issues (20)

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.