fluttercandies / flutter_photo_manager

A Flutter plugin that provides images, videos, and audio abstraction management APIs without interface integration, available on Android, iOS, macOS and OpenHarmony.
https://pub.dev/packages/photo_manager
Apache License 2.0
671 stars 304 forks source link

[How to use] Update a modified video in the Library #1065

Closed kaciula closed 3 months ago

kaciula commented 9 months ago

Platforms

iOS

Description

I want to be able to modify a video from an album and to update it in the album and Library.

My code

I am getting the originFile, modify it and save it in place. But the changes do not appear in the video from the album. So I am guessing the originFile isn't actually the original file but it's only a copy.

Try do it

No response

AlexV525 commented 9 months ago

Please provide details of your issue. It's unclear for us about what environment we need to reproduce.

kaciula commented 9 months ago

@AlexV525

`// Get origin video file

(await AssetEntity.fromId(fileId))!.originFile

// Do some modifications to the origin video file such as trim start and end of video using video tools and save as originFile

// The iPhone gallery does not show the updated video. How can I replace the original video file with the modified one in the Gallery? `

AlexV525 commented 9 months ago

What I meant is provide a detailed platform/package/flutter information, also whether the video is captured as any special type such as HDR, and whether it's uploaded to iCloud and whether it's locally available. And any other necessary information.

AlexV525 commented 9 months ago

Bonus point: record a screenrecording using the example of the plugin to reproduce.

AlexV525 commented 9 months ago

BTW, after modifications, you'll need to refetch the entity to grab it's latest references in order to obtain the correct file.

kaciula commented 9 months ago

@AlexV525 I am refetching the entity but getMediaUrl still shows the original video file. And the iPhone Photos app still shows the original video file. But the originFile contains the modified video file.

AlexV525 commented 3 months ago

I am getting the originFile, modify it and save it in place. But the changes do not appear in the video from the album. So I am guessing the originFile isn't actually the original file but it's only a copy.

Reviewing the request again, the plugin is not scoping to modify assets in the gallery, and it does make a copy into the sandbox of your app due to security limitations.