Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video element: add support for HTTP Live Streaming playlist #402

Closed
lolodomo opened this issue Oct 10, 2017 · 26 comments
Closed

Video element: add support for HTTP Live Streaming playlist #402

lolodomo opened this issue Oct 10, 2017 · 26 comments

Comments

@lolodomo
Copy link
Contributor

Please add support for HTTP Live Streaming playlist.
As it is working in Chrome on Android, I suppose it could work in the app too.
You can see how it was easy to update Basic UI and Classic UI: eclipse-archived/smarthome#4386
The general idea is to bypass the proxying and to use a particular media type.

@mueller-ma
Copy link
Member

mueller-ma commented Oct 11, 2017

This line adds the URL to the player: https://github.com/openhab/openhab.android/blob/master/mobile/src/main/java/org/openhab/habdroid/ui/OpenHABWidgetAdapter.java#L554

It adds http://openhab/proxy?sitemap=test.sitemap&widgetId=0100 which returns (in FF)
Invalid URL The requested URL "[no URL]", is invalid.

But when I hardcode on of the URLs you mentioned here than it works.

So is this more a openhab server problem?

@lolodomo
Copy link
Contributor Author

Very exciting to know that it can work.
Remains to analyze how is built the object openHABWidget by the Android app and to patch it.
Sorry I really don't know the app source code and can't help immediately.

@mueller-ma
Copy link
Member

It just opens the URL it gets from the rest api

@lolodomo
Copy link
Contributor Author

The sitemap REST API ?
In this case, I could probably have a look myself. More and more exciting lol

@mueller-ma
Copy link
Member

How does the basic ui access videos? Directly or through oh proxy?

@lolodomo
Copy link
Contributor Author

Basic UI is using the proxy except when encoding is set to HLS.
I think there is 2 changes to apply:

  • in the REST API, set url to the default URL defined in the sitemap but only when encoding is set to HLS.
  • in openHAB app, consider the special case with encoding set to HLS: in this case, use value from item if defined or the value from url if not

On my side, I can change the REST API.

@mueller-ma
Copy link
Member

When we can get the configured url from the rest api, I can change the android app.

@lolodomo
Copy link
Contributor Author

lolodomo commented Oct 12, 2017

I submitted the PR for the REST API change: eclipse-archived/smarthome#4412
With this change, the example with Video url="https://bitdash-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8" encoding="HLS" is now working in current openHAB app.
As previously explained, a change is still required in openHAB app to consider the case the URL is provided through an item like Video item="xxx" url="yyy" encoding="HLS"

@mueller-ma
Copy link
Member

Does oh 2.1 support item in a video element? I'm getting the following error:

Items:
String test_video "Video" <mediacontrol>

Sitemap:
Video item=test_video

Error:
[WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'test.sitemap' has errors, therefore ignoring it: [42,5]: rule ruleVideo failed predicate: {getUnorderedGroupHelper().canLeave(grammarAccess.getVideoAccess().getUnorderedGroup_1())}?

@lolodomo
Copy link
Contributor Author

The url= is mandatory in the video element and must contain a default url in case the item is not set.

@lolodomo
Copy link
Contributor Author

For information, if I try Video url="http://www.openhab.org/assets/smarthome.mp4", the video is not rendered in app. In this case, the URL uses the proxy.
Note that it is working in Basic UI.
Could it be due to incompatibility of the Android media player with MP4 files ?
I have not tried to disable the proxy to check if it helps but I will do.

@lolodomo
Copy link
Contributor Author

If I disable the proxying, the video is rendered. It looks like the proxying generates problems with the openHAB app. I don't really know why it is done lkie that (proxy) and if it makes sense for video.

@lolodomo
Copy link
Contributor Author

@kaikreuzer : can you please remind us why we are proxying all images and videos ? It seems to be the source of problems...

@lolodomo
Copy link
Contributor Author

@mueller-ma : I have now an Android dev env, I can work on this one if you like.

@mueller-ma
Copy link
Member

Sure, if you want.

@lolodomo
Copy link
Contributor Author

@mueller-ma : I have a first and stupid problem. My Android emulator is running openHAB app but is unable to connect to any openHAB server on my local network. I just read that the emulator is in fact hidden behind a firewall. Can you please explain what I have to do to connect to any local openHAB server, like the server I am running from Eclipse ?

@mueller-ma
Copy link
Member

I have the same problem, but mostly I use my physical tablet to run apps.

@lolodomo
Copy link
Contributor Author

@digitaldan : what's your solution ?

If I use my tablet, the dev app will be installed on my tablet and replace the app installed from the Hoogle store?

@mueller-ma
Copy link
Member

Yes

@lolodomo
Copy link
Contributor Author

REST API change is now merged.

@lolodomo
Copy link
Contributor Author

Would it be possible to get short explanations on how the app is handling wiidget updates and where is the entry point in the code for the handling of these update events ? Is SSE used ?

@mueller-ma
Copy link
Member

I don't know it either, but you could start with OpenHABWidgetListFragment line 306

@lolodomo
Copy link
Contributor Author

I want to understand how is worling the app and how the update from server are handled.

@lolodomo
Copy link
Contributor Author

The REST API fix is now available in all OH snapshots.

lolodomo added a commit to lolodomo/openhab.android that referenced this issue Oct 19, 2017
Fixes openhab#402

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
@lolodomo
Copy link
Contributor Author

Please note I opened issue #417 for the problem with the display of the file smarthome.mp4.

digitaldan pushed a commit that referenced this issue Oct 28, 2017
Fixes #402

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants