Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23937] iOS: Edited videos are not saved to photo gallery

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-09-28T05:13:34.000+0000
Affected Version/sRelease 6.0.0
Fix Version/sRelease 6.0.0
ComponentsiOS
Labelsqe-6.0.0
ReporterEric Wieber
AssigneeHans Knöchel
Created2016-09-21T20:44:20.000+0000
Updated2016-09-28T14:22:57.000+0000

Description

If a recorded video is edited (by changing/dragging the start or end points) then the video is not saved to the photo gallery, even though saveToPhotoGallery is true. *Steps to reproduce issue* 1. Create a new project and use the code below 2. Build the project for an iOS device 3. Click Open Camera 4. Record a video 5. Edit the start or end points of the video by dragging the bars at the edges of the timeline at the top of the screen 6. Click Use Video 7. Go the device's photo gallery *Expected Results* The edited video is present, as per our docs: {quote} saveToPhotoGallery (boolean) whether modified media should be saved back to the gallery, generally only useful with allowEditing=true {quote} *Actual Results* The edited video is not present *Notes* If you do not edit the video, it is correctly saved to the photo gallery If on iOS 10 you need to add these keys to your tiapp.xml:
<key>NSCameraUsageDescription</key>
<string>Can we use your camera?</string>
<key>NSMicrophoneUsageDescription</key>
<string>Can we use your microphone?</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Can we save to your library?</string>
*Code*
var win = Titanium.UI.createWindow({
    backgroundColor: "#FFFFFF"
});
 
var button = Titanium.UI.createButton({
    title: "Open camera"
});
 
button.addEventListener("click", function(e) {
    if (!Ti.Media.hasCameraPermissions()) {
        Ti.Media.requestCameraPermissions(takeVideo);
    } else {
        takeVideo();
    }
});
 
win.add(button);
win.open();
 
function takeVideo() {
    Ti.Media.showCamera({
        success: function(e) {
            Ti.API.info("Video captured successfully!");
        },
        error: function(e) {
            alert("There was an error");
        },
        cancel: function(e) {
            alert("The event was cancelled");
        },
        allowEditing: true,
        saveToPhotoGallery: true,
        mediaTypes: [Ti.Media.MEDIA_TYPE_VIDEO],
        videoQuality: Ti.Media.QUALITY_HIGH
    });
}

Comments

  1. Hans Knöchel 2016-09-22

    Hey [~ewieber]! -Only happening on Titanium SDK 6.0.0+ or also on 5.5.0? And only on iOS 10 or also iOS < 10? Need to get some more background to know where to look. Thanks!- *EDIT*: Probably cause by a side-effect of TIMOB-23699. It *is* caused by the above issue. The asset-writer gave a different URL than the one we use for the temporary directory. PR incoming.
  2. Hans Knöchel 2016-09-22

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/8414 PR (6_0_X): https://github.com/appcelerator/titanium_mobile/pull/8415
  3. Chee Kiat Ng 2016-09-28

    CR and FT passed. PRs merged.
  4. Harry Bryant 2016-09-28

    Verified as fixed, editing videos now save to the photo gallery correctly with saveToPhotoGallery set to true. When to set to false, the video is not saved. iPhone 6 Plus 10.0.1 Device iPhone 5S 9.3.5 Device Mac OSX El Capitan 10.11.6 Ti SDK: 6.0.0.v20160927221257 Appc Studio: 4.8.0.201609232005 Appc NPM: 4.2.8-7 App CLI: 6.0.0-54 Xcode 8.0 Node v4.4.7 *Closing ticket.*

JSON Source