Forums

OverviewFelgo 2 Support (Qt 5) › Camera image not saved on iOS – Camera imageCapture.capture()

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #19161

    Javier

    The file is not saved in this example on iOS. It works fine on Linux. I think the issue is related to the fact that I am not asked to give permission to write to photos even though the NSPhotoLibraryAddUsageDescription in the info.plist. This is the code and It can be also tested on the Felgo live app.

    https://felgo.com/web-editor/?snippet=fe6426d0

    import Felgo 3.0
    import QtMultimedia 5.9
    
    App{
        NavigationStack{
    
            Page {
                title: qsTr("Video")
    
                // Right-hand side buttons
                rightBarItem: NavigationBarRow {
    
                    // Capture image button
                    IconButtonBarItem {
                        title:     qsTr("Capture image")
                        icon:      IconType.camera
                        onClicked: camera.imageCapture.capture()
                    }
                }
    
                // Camera
                Camera {
                    id: camera
    
                    imageCapture{
                        onImageSaved:    console.log(qsTr("Image saved"))
                        onCaptureFailed: console.log(qsTr("Error capturing image: " + errorString))
                    }
                }
    
                // Live video output
                VideoOutput {
                    id: videoOutput
                    anchors.fill: parent
                    source: camera
                    autoOrientation: true
                    fillMode: VideoOutput.PreserveAspectCrop
                }
            }
        }
    }

     

    #19163

    Javier

    Sorry! the previous example works, but the picture is not shown in the “all photos” album, it is stored in another location instead, for example.

    /var/mobile/Containers/Data/Application/FBC3366D-0185-4D21-8FD4-F2E6F372A168/Documents/img_0001.jpg

    Is there any way to store this picture in the “all photos” albums? I cannot set the capturedImagePath, because it is a read-only property.

    #19167

    Alex
    Felgo Team

    Hi,

    there is also a captureToLocation method available for the imageCapture, you can give it a try. You might have to read the location for the photos with the QStandardPaths C++ class.

    Cheers,
    Alex

Viewing 3 posts - 1 through 3 (of 3 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support