ICEmobile
  1. ICEmobile
  2. MOBI-1140

BridgeIt camcorder not working on Android devices with removable storage

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: BridgeIt 1.0.5
    • Fix Version/s: BridgeIt 1.0.7
    • Component/s: BridgeIt
    • Labels:
      None
    • Environment:
      Android 4.4, extra SD card

      Description

      The camcorder command is not working on my Motorolla Android device. The camera and microphone commands work, but not the camcorder. Here is a suspicious stack trace:

      /jpg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAARCABOAE4DASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5eb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.640: E/ICEutil(3460): java.io.FileNotFoundException: /storage/emulated/0/mobi.bridgeit/video.mp4: open failed: ENOENT (No such file or directory)
      05-29 13:47:29.640: E/ICEutil(3460): at libcore.io.IoBridge.open(IoBridge.java:409)
      05-29 13:47:29.640: E/ICEutil(3460): at java.io.FileInputStream.<init>(FileInputStream.java:78)
      05-29 13:47:29.640: E/ICEutil(3460): at java.io.FileInputStream.<init>(FileInputStream.java:105)
      05-29 13:47:29.640: E/ICEutil(3460): at org.icemobile.client.android.util.d.submitForm(Unknown Source)
      05-29 13:47:29.640: E/ICEutil(3460): at org.icemobile.client.android.sxcore.SxCore.onActivityResult(Unknown Source)
      05-29 13:47:29.640: E/ICEutil(3460): at android.app.Activity.dispatchActivityResult(Activity.java:5446)
      05-29 13:47:29.640: E/ICEutil(3460): at android.app.ActivityThread.deliverResults(ActivityThread.java:3428)
      05-29 13:47:29.640: E/ICEutil(3460): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3475)
      05-29 13:47:29.640: E/ICEutil(3460): at android.app.ActivityThread.access$1300(ActivityThread.java:139)
      05-29 13:47:29.640: E/ICEutil(3460): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1258)
      05-29 13:47:29.640: E/ICEutil(3460): at android.os.Handler.dispatchMessage(Handler.java:102)
      05-29 13:47:29.640: E/ICEutil(3460): at android.os.Looper.loop(Looper.java:136)
      05-29 13:47:29.640: E/ICEutil(3460): at android.app.ActivityThread.main(ActivityThread.java:5086)
      05-29 13:47:29.640: E/ICEutil(3460): at java.lang.reflect.Method.invokeNative(Native Method)
      05-29 13:47:29.640: E/ICEutil(3460): at java.lang.reflect.Method.invoke(Method.java:515)
      05-29 13:47:29.640: E/ICEutil(3460): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
      05-29 13:47:29.640: E/ICEutil(3460): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
      05-29 13:47:29.640: E/ICEutil(3460): at dalvik.system.NativeStart.main(Native Method)
      05-29 13:47:29.640: E/ICEutil(3460): Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
      05-29 13:47:29.640: E/ICEutil(3460): at libcore.io.Posix.open(Native Method)
      05-29 13:47:29.640: E/ICEutil(3460): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
      05-29 13:47:29.640: E/ICEutil(3460): at libcore.io.IoBridge.open(IoBridge.java:393)
      05-29 13:47:29.640: E/ICEutil(3460): ... 17 more
      05-29 13:47:29.651: D/SxCore(3460): onActivityResult completed TAKE_VIDEO_CODE

      Apparently the video is successfully recorded, the thumbnail is successfully created, but BridgeIt cannot locate the video file for the file submission to upload. It doesn't check that the file has or has not been located, but continues to try to upload, resulting in a server exception, which is then passed back to the client:

      05-29 13:47:46.160: I/chromium(2108): <head><title>504+Gateway+Time-out</title></head>
      05-29 13:47:46.160: I/chromium(2108): <body+bgcolor="white">
      05-29 13:47:46.160: I/chromium(2108): <center><h1>504+Gateway+Time-out</h1></center>
      05-29 13:47:46.160: I/chromium(2108): <hr><center>nginx/1.4.6+(Ubuntu)</center>
      05-29 13:47:46.160: I/chromium(2108): </body>
      05-29 13:47:46.160: I/chromium(2108): </html>
      05-29 13:47:46.160: I/chromium(2108): ", source: http://192.168.0.101:4000/camcorder.html (120)
      05-29 13:47:46.160: I/chromium(2108): [INFO:CONSOLE(651)] "BridgeIt Device function callback 'function onAfterVideoCapture(event) {
      05-29 13:47:46.160: I/chromium(2108): console.log('handleVideo preview: ' + event.preview);
      05-29 13:47:46.160: I/chromium(2108): if (event.preview) {
      05-29 13:47:46.160: I/chromium(2108): document.getElementById("videoThumbnail").setAttribute("src", event.preview);
      05-29 13:47:46.160: I/chromium(2108): document.getElementById("currentVideoDesc").innerHTML = "Last video taken at " + new Date();
      05-29 13:47:46.160: I/chromium(2108): }
      05-29 13:47:46.160: I/chromium(2108): console.log('handleVideo response: ' + event.response);
      05-29 13:47:46.160: I/chromium(2108): if (event.response) {
      05-29 13:47:46.160: I/chromium(2108): var cleanResponse = event.response.replace(/\+/g,'');
      05-29 13:47:46.160: I/chromium(2108): var jsonResp = JSON.parse(cleanResponse);
      05-29 13:47:46.160: I/chromium(2108): var row = document.createElement('div');
      05-29 13:47:46.160: I/chromium(2108): row.setAttribute('class','row');
      05-29 13:47:46.160: I/chromium(2108): var elem = document.getElementById('videos');
      05-29 13:47:46.160: I/chromium(2108): elem.insertBefore(row,elem.firstChild);
      05-29 13:47:46.160: I/chromium(2108): row.innerHTML = "<a class='btn ui-btn ui-shadow ui-btn-corner-all ui-btn-up-c' onclick=\"loadVideo(this,'" +
      05-29 13:47:46.160: I/chromium(2108): (jsonResp.uri || jsonResp.location ) + "');\">Load Video</a>";
      05-29 13:47:46.160: I/chromium(2108): }
      05-29 13:47:46.160: I/chromium(2108): }' failed, make sure that the callback function is in global scope.", source: http://192.168.0.101:4000/bridgeit.js (651)
      05-29 13:47:46.170: I/chromium(2108): [INFO:CONSOLE(652)] "SyntaxError: Unexpected token <
      05-29 13:47:46.170: I/chromium(2108): at Object.parse (native)
      05-29 13:47:46.170: I/chromium(2108): at onAfterVideoCapture (http://192.168.0.101:4000/camcorder.html:123:33)
      05-29 13:47:46.170: I/chromium(2108): at http://192.168.0.101:4000/bridgeit.js:648:7", source: http://192.168.0.101:4000/bridgeit.js (652)
      05-29 13:47:46.193: I/SFPerfTracer(262): triggers: (rate: 1:64) (0 sw vsyncs) (0 skipped) (36:1867135 vsyncs) (38:2649953)
      05-29 13:47:46.211: I/ActivityManager(994): START u0 {act=android.intent.action.MAIN flg=0x10000000 pkg=com.android.chrome

      I'm not seeing any issue with the camcorder on other Android devices, so far, so my hunch is that this might be due to this device having a removable SD Card where and the way we locate the video file (differently than we locate the photos or audio recordings) in VideoHandler.java.

        Activity

        Philip Breau created issue -
        Hide
        Patrick Corless added a comment -

        Is a card mounted in the external SD?

        Show
        Patrick Corless added a comment - Is a card mounted in the external SD?
        Hide
        Philip Breau added a comment -

        Yes, and if I unmount the SD Card it works ok.

        Show
        Philip Breau added a comment - Yes, and if I unmount the SD Card it works ok.
        Hide
        Patrick Corless added a comment -

        Thanks for the info. Should have test device running 4.1+ tomorrow that has a card reader. There were some permission changes in 4.1 which I'm hoping will be reproducible with the hardware. .

        Show
        Patrick Corless added a comment - Thanks for the info. Should have test device running 4.1+ tomorrow that has a card reader. There were some permission changes in 4.1 which I'm hoping will be reproducible with the hardware. .
        Hide
        Patrick Corless added a comment -

        The issue was reproducible with an Samsung s4 mini running 4.4.2. When a sd card is present there camcorder application will automatically switch over to using the card vs. internal storage. This is configurable, you can switch back to the internal storage but the default is external storage.

        When we initiate our VideoHandler a temp file is written to the mobi.bridgeit namespace on the internal storage and is later used for the upload. This is where the trouble starts as the camcorder code will write a new file to the external storage that can't be moved back to the internal storage (nor should it). On our test device the last uploaded camcorder file is re-uploaded if present but on a new install an file not found exception would occur.

        A few code tweaks have been made to insure the proper file location is stored and used for the file upload stream. The app permission READ_EXTERNAL_STORAGE has also been added as external storage permission is respected in android 4.1 and higher.

        Show
        Patrick Corless added a comment - The issue was reproducible with an Samsung s4 mini running 4.4.2. When a sd card is present there camcorder application will automatically switch over to using the card vs. internal storage. This is configurable, you can switch back to the internal storage but the default is external storage. When we initiate our VideoHandler a temp file is written to the mobi.bridgeit namespace on the internal storage and is later used for the upload. This is where the trouble starts as the camcorder code will write a new file to the external storage that can't be moved back to the internal storage (nor should it). On our test device the last uploaded camcorder file is re-uploaded if present but on a new install an file not found exception would occur. A few code tweaks have been made to insure the proper file location is stored and used for the file upload stream. The app permission READ_EXTERNAL_STORAGE has also been added as external storage permission is respected in android 4.1 and higher.
        Patrick Corless made changes -
        Field Original Value New Value
        Fix Version/s BridgeIt 1.0.7 [ 12370 ]
        Hide
        Patrick Corless added a comment -

        Marking as fixed.

        Show
        Patrick Corless added a comment - Marking as fixed.
        Patrick Corless made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Patrick Corless
            Reporter:
            Philip Breau
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: