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

Android: requestThumbnailImagesAtTimes causes a crash

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Release 6.2.0
    • Component/s: None

      Description

      index.js:

      var button = Ti.UI.createButton({
          title: "record"
      });
       
      button.addEventListener('click', recordVideo);
       
      $.win.add(button);
      $.win.open();
       
      function recordVideo() {
          var permissionsToRequest = [];
       
          var audioPermission = "android.permission.RECORD_AUDIO";
          var hasAudioPerm = Ti.Android.hasPermission(audioPermission);
          if (!hasAudioPerm) {
              permissionsToRequest.push(audioPermission);
          }
       
          var cameraPermission = "android.permission.CAMERA";
          var hasCameraPerm = Ti.Android.hasPermission(cameraPermission);
          if (!hasCameraPerm) {
              permissionsToRequest.push(cameraPermission);
          }
       
          var storagePermission = "android.permission.READ_EXTERNAL_STORAGE";
          var hasStoragePerm = Ti.Android.hasPermission(storagePermission);
          if (!hasStoragePerm) {
              permissionsToRequest.push(storagePermission);
          }
          if(permissionsToRequest.length > 0) {
              Ti.Android.requestPermissions(permissionsToRequest, function (e) {
                  if (e.success) {
                      showCamera();
                  }
              });
          } else {
              showCamera();
          }
      }
       
      function showCamera() {
          Ti.Media.showCamera({
              autohide: false,
              animated: false,
              allowEditing: false,
              success:function(event) {
                  var movie = Titanium.Media.createVideoPlayer({
                      url:event.media.nativePath,
                      backgroundColor:'#111',
                      mediaControlStyle: Titanium.Media.VIDEO_CONTROL_EMBEDDED,
                      scalingMode:Titanium.Media.VIDEO_SCALING_ASPECT_FILL,
                      width:300,
                      height:300,
                  });
                  $.win.add(movie);
       
                  movie.addEventListener('durationavailable', function() {
                      movie.requestThumbnailImagesAtTimes([1], Titanium.Media.VIDEO_TIME_OPTION_NEAREST_KEYFRAME, function(response) {
                          Ti.API.info("Thumbnail callback called, success = " + response.success);
                          console.log(response);
                          if(response.success) {
       
                          }
                      });
                  });
              },
              cancel:function() {
                  console.log("cancel");
              },
              error:function(error) {
                  console.log("error");
                  console.log(error);
              },
              mediaTypes: [Ti.Media.MEDIA_TYPE_VIDEO],
          });
      }
      

      I'm getting this exception:

      [WARN]  W/System.err: java.lang.NullPointerException: Attempt to invoke interface method 'boolean android.database.Cursor.moveToNext()' on a null object reference
      [WARN]  W/System.err:   at org.appcelerator.titanium.io.TitaniumBlob.init(TitaniumBlob.java:84)
      [WARN]  W/System.err:   at org.appcelerator.titanium.io.TitaniumBlob.<init>(TitaniumBlob.java:33)
      [WARN]  W/System.err:   at ti.modules.titanium.media.VideoPlayerProxy.requestThumbnailImagesAtTimes(VideoPlayerProxy.java:722)
      [WARN]  W/System.err:   at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)
      [WARN]  W/System.err:   at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62)
      [WARN]  W/System.err:   at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:872)
      [WARN]  W/System.err:   at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1095)
      [WARN]  W/System.err:   at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:360)
      [WARN]  W/System.err:   at ti.modules.titanium.media.VideoPlayerProxy.handleMessage(VideoPlayerProxy.java:395)
      [WARN]  W/System.err:   at android.os.Handler.dispatchMessage(Handler.java:98)
      [WARN]  W/System.err:   at android.os.Looper.loop(Looper.java:148)
      [WARN]  W/System.err:   at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:118)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ybanev Yordan Banev
                Reporter:
                zozo4kin Zakhar Zhuravlev
                Reviewer:
                Gary Mathews
                Tester:
                Samir Mohammed
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-10929
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code