iupui-soic / mHBS-trainer

Moved here: https://gitlab.com/librehealth/incubating-projects/mhbs/mHBS-trainer
https://neoinfo.iu.edu
Mozilla Public License 2.0
10 stars 15 forks source link

Create preliminary videos and PDFs in DHIS2 and pull them in through our app #39

Open Ezmeyers opened 7 years ago

Ezmeyers commented 7 years ago

Tasks will include creation of adapter to handle data on the learner tracker end and modification of list activity to support handling the different data types.

Ezmeyers commented 7 years ago

Pdf and video uploaded for testing in resources on DHIS2. We decided to use the SDK afterall and @jmfranci has bundled it and made a broadcast with capture tracker. Once we get the commit up I can start pulling in the data.

sunbiz commented 7 years ago

I would advice against making changes to the SDK. We might be upgrading to a newer release of the SDK and so it might not be a good idea to make changes to the SDK. Better to make these changes in the tracker capture app or the training app.

Ezmeyers commented 7 years ago

Yeah, we don't want to touch the SDK, I just meant compiling it within our training app, which we don't currently have. Sorry for the lack of clarity!

shbucher commented 6 years ago

@Ezmeyers @sunbiz @sivaadde , I would request, as we continue to work on this issue, building upon what the MURI team did Summer 2017, that we deliberately utilize Global Health Media Project videos for demonstrative and beta-testing purposes.

All videos are found here: https://globalhealthmedia.org/videos/

To start with, perhaps we can pull into mHBS/DHIS2 the following GHMP videos (each found at the link above):

--Preparing the birth room --Preparing for the Birth of a Small Baby --Wrap designs for skin-to-skin care

Ezmeyers commented 6 years ago

@sivaadde I see there is now DhisController.getInstance().getDhisApi().getResources() so I think we can pull them in that way!

sunbiz commented 6 years ago

We have found that you can call the Web API and access the resources. We have the two resources, one is a PDF and one is WebM video and can be accessed through https://mhbs.info/api/documents

We can also get more details like the content-type of each resource using - https://mhbs.info/api/documents/Eo5RJRxit6v

Ezmeyers commented 6 years ago

@sunbiz For some reason when I go to https://mhbs.info/api/documents and I am not logged in, I cannot view the page. I thought since it is public, it should be viewable...I created the XML parser and pulled in the page, but it's directing me to a blank login page at https://mhbs.info instead and pulling HTML from there. So instead of the document XML I am getting tags from the login page.

Ezmeyers commented 6 years ago

Since I wasn't able to access the DHIS XML via the URL, I worked on the functionality with some other sample XML. I Created the xml parser and am able to pull/parse web xml data. I also added functionality for the videos and resources to display different views when navigating through the respective portals. I am now working on putting sample data in the lists, at least as a proof of concept until the proper XML can be pulled.

Ezmeyers commented 6 years ago

I am wondering if the auth isn't working because I need to use HttpsURLConnection over HttpURLConnection since the site is over HTTPS?, perhaps it wont accept the authenticator in conjunction with HTTP. This may be the incorrect route, but it's what I am currently trying since I do see there is HTTPS connection class.

sunbiz commented 6 years ago

@Ezmeyers, You can use HttpURLConnection to work with https from a trusted CA. We are using letsencrypt and thats a trusted CA for most reasons. Is this committed some place for me to test out and help?

Ezmeyers commented 6 years ago

Update; I have solved this issue, I can get the correct XML now. I will finish up this file, push the changes to my fork, and then begin populating the list! The issue was that we I couldn't use the default authentication, I had to explicitly call authentication.

Ezmeyers commented 6 years ago

on my Fork I correctly pulled in the content type and associated with IDs. I am now going to get other textual information for items that need to populate based on resource type. I was able to dynamically put data into the list based on content types of the resources.

Ezmeyers commented 6 years ago

I got the titles populating, I need to clean up the code and rewrite some of it. I am now throwing myself into downloading, which goes also includes getting thumbnails.

Ezmeyers commented 6 years ago

What format did we decide to go with for Pdfs/videos? Do we have a list of them already formatted? I wanted to upload some more to resources for testing purposes. I can use dummy data, I was just wondering.

sunbiz commented 6 years ago

@Ezmeyers, We have two of them - one pdf and another video uploaded to mhbs.info. Please use those!

Ezmeyers commented 6 years ago

@sunbiz I am using those, I just wanted more, for test purposes, but I can just duplicate them.

Ezmeyers commented 6 years ago

@sunbiz It looks like the Video View can't play webm format videos. Any suggestions?

sunbiz commented 6 years ago

VP9 coded webm is surely supported from Android 4.4 onwards. Can you check the MediaCodecInfo and check the capabilities? Any error logs that you can post when you try start().

Ezmeyers commented 6 years ago

All I get is: E/MediaPlayer: error (1, -2147483648)

and the app displays "Can't play this Video" I also tried a static webm from online and the same thing happens. selection_004

Update: I must have forgotten to set something since no this occurs for all video formats I try to play, will get this fixed asap and prepare for the PR.

Ezmeyers commented 6 years ago

So it looks like this is the problem detailed here

Your url returned html code, and VideoView needed streaming resource (full path to the video).

Found out the files which were supposed to be video were grabbing login HTML which means the auth didn't work for videos, which is weird because it works fine for PDFs so I am working on that now and will update with the fix.

Ezmeyers commented 6 years ago

@sunbiz found that videos that are uploaded to DHIS2 are encoded with VP8 that is not available in the 5.1 lollipop emulator