-
Notifications
You must be signed in to change notification settings - Fork 779
Conversation
Two new channels have been added.
|
Are you using the |
@watou: for the string item, yes I am using url= and item= parameters: |
So HABdroid isn't showing any image for you, or only showing the trippy Sonos logo? |
Just no image at all. |
As it is working in Basic UI and Classic UI, I suppose my item/sitemap declarations are correct. |
I wonder if it's a problem with the proxy servlet, perhaps similar to what was reported here. Hard to tell from the app though, but on a browser you could open the Developer Tools and inspect the HTTP headers of the request/response to look for oddities. |
There is a possible enhancement I can propose that will simplify the code for any binding wanting to deal with image items: adding a new constructor for RawType that will take as parameter an URL. It will download the data from the URL and store it in the internal array of bytes.
Let me know if you are interested and if you think that it is a good idea. |
Not an argument against, but consider multi-megabyte images held in server memory, URLs that never stop streaming, 4xx/5xx or other error responses, etc., and whether this handling can or should be generalized, or better left to the ultimate consuming client. |
Ok, I can agree, that was just an idea I wanted to share with you. By the way, that is only few lines of code to download the image when using IOUtils. Note that in the Sonos binding, the image will be download in memory only if the channel is linked. Everyone has the choice and users with not a lot of RAM could decide to rather use the URL advanced channel. |
@watou: I will try to inspect what are the headers provided by Sonos in the response. Your hypothesis is that HABdroid (or the proxy servlet ?) is relying on certain HTTP headers and less compatible than Chrome or Firefox browsers ? |
That depends on whether you can see images at all in your HABdroid. I've not looked at the HABdroid code, but it might be more restrictive in fetching/handling images that the Android System WebView.
No; it sounds like a HABdroid deficiency. Can you see any images from other sources in HABdroid? In my setup I've always seen expected images from I would be curious if you could test #2753 since it uses a more thorough proxy implementation, to see if that makes any difference. You would have to build it, disable the equivalent bundle and add it to addons. |
@watou: I will try with other Image elements just using the url parameter and let you know if it is at least working sometyimes. |
Signed-off-by: Laurent Garnier <[email protected]>
I have now documented the two new channels (in README.md). |
@watou : here is what I can find using Firefox (and Basic UI):
Response headers:
What we can notice is that there is no "Content-Type" in the response headers. Is it what could explain the no display in HABdroid ? |
Could it be the proxy servlet that suppress the Content-Type header ? |
Most definitely a likely suspect. The response headers should have a Content-Type. I think modern browsers are smart enough to derive the image type from the raw image data, while the app may not have this ability. This is another reason I'm wary of I wonder if the Sonos people could make an effort to fix their firmware to return proper HTTP response headers for cover art? The proxy servlet would not be the place to augment the response headers to compensate for this lack of information. If the theory is founded, it's conceivable that HABdroid could possibly become as "smart" as browsers in deriving the image type from the raw data. Maybe. |
Very interesting, if I select the line-in input, the default image is used (the one in my url= parameter) and in this case I see the picture in HABdroid. I can see using the browser development tools that in this case there is a Content-Type header in the response. So the problem is clear, Sonos is not providing the Content-Type header in the response and this makes HABdroid not displaying the picture. |
This leads to one of my unanswered questions: what will happen for UI that will have an array of bytes (RawType) without knowing what image format it is ? It is apparently correctly handled by WEB browsers (Paper UI) but this will not be a difficulty for HADdroid ? |
Just a last word, the cover art are displayed even in HABdroid if I play an album from my local library but it does not work when I use Tune-in or Spotify services. |
Excellent diagnosis, @lolodomo. To summarize: HABdroid ought to be made smarter (if possible) to sniff out image types from raw image data, when Content-Type isn't provided, like browsers do, but ideally the source of the image should provide the Content-Type and be delivered all the way to the client. Correct? |
I have some doubts about my summary above. This line in the Android client shows that the image type is being figured out by the raw data after all. To me, #2734 (proxy servlet bug copying headers) looks more likely. Since I don't have the Sonos hardware you do, I can't test my theory. @lolodomo, could you try to build and test #2753 to see if it makes any difference? (I had to add a Directory to the Target Platform in the Eclipse IDE for OH2 that included |
@watou: I compiled your branch but unfortunately I can't find your jetty proxy jar file. In my target directory, I can find only org.eclipse.smarthome.ui-0.9.0-SNAPSHOT.jar. Is it the jar file to put in my addons folder ? |
I did my testing for the PR in the IDE, but you ought to be able to add this JAR to you addons folder as well as use the org.eclipse.smarthome.ui-0.9.0-SNAPSHOT.jar you built. It can be quite a challenge to test changes to SmartHome under OH2, but there might be shortcuts I just don't know yet. 🙂 |
@kgoderis: could you please review my change ? |
@watou : unfortunately, I cannot start your bundle. After uninstallaing the default bundle and trying to start the new one, I got this error:
I could try later in Eclipse IDE. |
Did you try
? If that still doesn't help resolve the packages, yes please try in Eclipse IDE when you can, and remember to add it to the target platform there. SmartHome still uses Jetty 9.2.9 iirc, but OH2 uses 9.2.12. The PR is compatible with both. |
No I tried to install the bundle org.eclipse.smarthome.ui I compiled from your sources. |
I'm no expert in this, but I think you can stop the installed bundle and install and start the one you compiled, which has the dependency on the Jetty proxy bundle as above. Uninstalling the feature is probably a bad idea as you will lose others in the process. Testing on a test server install or via the Eclipse IDE is probably wisest. Sorry I don't have the definitive steps to test it. Back when I made a living programming, OSGi had only just been born. 😄 |
I don't know if this dropbox link really just spit out the binary file or does a redirect. Maybe, I'd really appreciate that change being merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works nicely, many thanks!
Signed-off-by: Laurent Garnier [email protected]