Uploaded image for project: 'mUzima'
  1. mUzima
  2. MUZIMA-176

Create Javascript Interface in muzima to display videos in forms

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Major
    • Resolution: Done
    • Labels:

      Description

      The Lark study requires that we display images and videos as part of the forms to help in decision support and provide education to patients to achieve this a Javas script Interface in muzima is required to enable forms to display the images and the videos as per the discussions on IRC

      10:17 PM <manutarus> hi nribeka
      10:17 PM <nribeka> hi manutarus
      10:17 PM <nribeka> what's up?
      10:18 PM <manutarus> i need help with displaying a video within a form nribeka
      10:18 PM <nribeka> for which form is this going to be manutarus?
      10:19 PM <nribeka> do you plan to load the video manually as we don't have the mechanism to send video to device yet?
      10:20 PM <manutarus> the lark retention form nribeka they have some videos for the chv's to display to patients depending on the given logic
      10:21 PM <manutarus> yes nribeka we shall load the video to the sdcard manually
      10:23 PM <nribeka> if the video is available in sdcard, i think it's going to be a bit easier
      10:24 PM <nribeka> i think the easiest way would be to use link. when the user click the link, the apps will send intent to view video
      10:29 PM <manutarus> trying this nribeka
      10:29 PM <manutarus> <video id="larkVideoOne" src="/home/manu/Desktop/v1.mp4" controls></video>
      10:30 PM <nribeka> http://stackoverflow.com/questions/11189631/how-to-play-a-video-mp4-from-assets-or-raw-folder-with-the-video-intent
      10:32 PM <nribeka> so you will have a link manu
      10:33 PM <nribeka> <a class="video-player" data-video="uri to video">Open this video</a>
      10:34 PM <nribeka> $('.video-player').click(function(){
      10:34 PM <nribeka> var videoUri = $(this).attr('data-video');
      10:34 PM <nribeka> openVideo(videoUri);
      10:34 PM <nribeka> {);
      10:34 PM <nribeka> and then have a javascript interface for the openVideo
      10:36 PM <nribeka> @JavascriptInterface
      10:36 PM <nribeka> public void openVideo(String videoUri)

      { 10:36 PM <nribeka> Intent tostart = new Intent(Intent.ACTION_VIEW); 10:36 PM <nribeka> String movieUrl = "file:///android_asset/myvideo.mp4"; --> this should be replaced with path to the video file from videoUri 10:36 PM <nribeka> tostart.setDataAndType(Uri.parse(movieUrl), "video/*"); 10:36 PM <nribeka> startActivity(tostart); 10:36 PM <nribeka> }

      10:36 PM <nribeka> something like that I would think
      10:37 PM <nribeka> can you post a ticket for this manu
      10:37 PM <nribeka> and paste this conversation we have
      10:38 PM <nribeka> as we want to create a standard way to do this
      10:49 PM <manutarus> thanks nribeka trying this will let you know
      10:49 PM <nribeka> please file the ticket as well manutarus
      10:49 PM <nribeka> along with the discussion here as reference
      10:50 PM <manutarus> okay nribeka will do that
      10:50 PM <nribeka> cool manutarus
      11:11 PM <manutarus> so the JavascriptInterface for openVideo is this already created nribeka or we shall have to create it in muzima
      11:12 PM <nribeka> not yet manutarus
      11:12 PM <nribeka> that's why we need a ticket for this conversation
      11:13 PM <manutarus> aha sawa nribeka
      11:17 PM <nribeka> cool cool manutarus

        Gliffy Diagrams

          Attachments

            Activity

              People

              Assignee:
              vpandey Vikas Pandey
              Reporter:
              tarus Emmanuel Tarus
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: