Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-24707

Android: Add video support to Ti.Media.openPhotoGallery()

    Details

    • Story Points:
      5
    • Sprint:
      2018 Sprint 06 SDK, 2018 Sprint 07 SDK, 2018 Sprint 08 SDK, 2018 Sprint 09 SDK

      Description

      Hello,

      We have tried to open the videos from Android gallery but its not opening.

      Testing Environment:
      Titanium SDK: 6.0.4.GA
      Appcelerator Command-Line Interface, version 6.2.0
      Android device: Samsung Galaxy Grand Prime(5.1.1)

      Test Code:

       
      var storagePermission = "android.permission.READ_EXTERNAL_STORAGE";
       
      var hasStoragePermission = Ti.Android.hasPermission(storagePermission);
       
      var permissionsToRequest = [];
       
      var win = Ti.UI.createWindow({
       
          title : 'mywin',
       
          backgroundColor : '#fff',
       
          width : Ti.UI.FILL,
       
          height : Ti.UI.FILL
       
      });
       
      win.open();
       
      if (!hasStoragePermission) {
       
          permissionsToRequest.push(storagePermission);
       
      }
       
      if (permissionsToRequest.length > 0) {
       
          Ti.Android.requestPermissions(permissionsToRequest, function(e) {
       
              if (e.success) {
       
                  Ti.API.info("SUCCESS");
       
              } else {
       
                  Ti.API.info("ERROR: " + e.error);
       
              }
       
          });
       
      }
       
      var btn1 = Ti.UI.createButton({
       
          title : 'Click',
       
          top : 60
       
      });
       
      win.add(btn1);
       
       
      btn1.addEventListener('click', function() {
       
      Ti.Media.openPhotoGallery({
          mediaTypes: [Ti.Media.MEDIA_TYPE_VIDEO],
          success: function (e) {
              Ti.API.info("Success");
          },
          cancel: function () {
          },
          error: function (e) {
              Ti.API.error(JSON.stringify(e));
          }
      });
       
      }); 

      Tiapp.xml

      <manifest>
       
       
       
                  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
       
       
       
                  <application android:hardwareAccelerated="true" android:largeHeap="true"/>
       
       
       
      </manifest>  
      

      Test Result:
      Just Opening the Photos from gallery but videos are not Opening.

      Expected Result:
      Open the videos also from Android App Gallery.

      Photo gallery API shows videos too for iOS. Am I missing something or this is not available for Android? If not available for Android, Can we consider it for improvement?

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jquick Joshua Quick
                Reporter:
                fhaque Fazlul Haque
                Reviewer:
                Gary Mathews
              • Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Git Source Code