Search results for

[tags:wwdc20-10661]

33 results found

Post

Replies

Boosts

Views

Activity

Could not load some videos
Hello there! I am trying to use PHPickerViewController to load videos, but I got a problem: I could load some videos only not all. I refer to the existing thread - https://developer.apple.com/forums/thread/652695, but dosen't work. This is the code I persent PHPickerViewController var config = PHPickerConfiguration() config.selectionLimit = 1 config.filter = .videos config.preferredAssetRepresentationMode = .current let picker = PHPickerViewController(configuration: config) picker.delegate = self present(picker, animated: true, completion: nil) Below is the relevant implementation of the method: func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]): picker.dismiss(animated: true, completion: nil) for result in results { result.itemProvider.loadFileRepresentation(forTypeIdentifier: UTType.movie.identifier) { (url, error) in if let error = error { print(error) return } guard let url = url else { return } let fileName = (Date().timeIntervalSince1970).(url.pathExtension) let ne
6
0
3.8k
May ’24
How to correctly load video selected with PHPickerViewController?
Hello! I am playing around with the PHPickerViewController and so far I was able to get the selected images by loading them into UIImage instances but I don't know how to get the selected video. Below is the relevant implementation of the method: func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]): let provider = result.itemProvider guard provider.hasItemConformingToTypeIdentifier(AVFileType.mov.rawValue) else { return } ttttttprovider.loadItem(forTypeIdentifier: AVFileType.mov.rawValue, options: nil) { (fileURL, error) in ttttttttif let error = error { ttttttttttprint(error) ttttttttttreturn tttttttt} ttttttttguard let videoURL = fileURL as? URL else { return } ttttttttDispatchQueue.main.async { ttttttttttlet fm = FileManager.default ttttttttttlet destination = fm.temporaryDirectory.appendingPathComponent(video123.mov) tttttttttttry! fm.copyItem(at: videoURL, to: destination) ttttttttttlet playerVC = AVPlayerViewController() ttttttttttplayerVC.player = AVPlayer(url: dest
13
0
10k
Sep ’23
Error during video loading with PHPickerViewController
We are using the PHPickerViewController to load photos and videos into our app. When an item was picked we load it using the loadFileRepresentation() method of NSItemProvider. In its callback we get the following error sometimes: Error copying file type public.movie. Error: Error Domain=NSItemProviderErrorDomain Code=-1000 Cannot load representation of type public.movie UserInfo={NSLocalizedDescription=Cannot load representation of type public.movie, NSUnderlyingError=0x281a87a50 {Error Domain=NSCocoaErrorDomain Code=4101 Couldn’t communicate with a helper application. UserInfo={NSUnderlyingError=0x281a85e30 {Error Domain=PHAssetExportRequestErrorDomain Code=0 (null) UserInfo={NSUnderlyingError=0x281a85620 {Error Domain=PFSharingRemakerErrorDomain Code=2 Underlying operation encountered an error UserInfo=0x280018500 (not displayed)}}}}}} The error seems to occur randomly when picking arbitrary videos. What does the error mean and how do we make the item provider load more reliably here?
1
0
1.2k
Apr ’21
PHPickerViewController enhancement: show assets previously selected
When a user picks asset(s) from the PickerView there should be an interface to return the user to the same album and asset. i.e. the PickerView should show the photoLibrary the way the user left it. This would remove the 'friction' of navigating to the same album when the user is making a change in their selection. In large or deep photoLibraries it is easy to lose track of the spot where a picture was found. In particular the PHPickerResult should return to the app the assetCollection localIdentifier, along with the asset localIdentifier. support an interface for passing the assetCollection and asset localIdentifier(s) to navigate to the same photo library location on the initial open. I would love to use PHPickerViewController as it could replace a significant amount of picking views and code in a photo filter app. But it needs a way to restore the visual state instead of searching again on every image pick. Thanks !! p.s. Is there a better way to submit enhancement requests (such as a bug report)?
1
0
1.2k
Mar ’21
Couple of questions regarding PHPicker
Hi, I've recently added PHPicker to my app and have gotten some returns and low sales that may or may not be a result of the change and just want to make sure my implementation is correct. I'm concerned about the pickerDidFinishPicking function in particular. Here is my simple implementation that allows the user to select one image from their photo library: (void) presentPHPickerController { PHPickerConfiguration *config = [[PHPickerConfiguration alloc] init]; config.filter = [PHPickerFilter imagesFilter]; PHPickerViewController *pickerViewController = [[PHPickerViewController alloc] initWithConfiguration:config]; pickerViewController.delegate = self; [self.navigationController presentViewController:pickerViewController animated:YES completion:nil]; } (void) picker:(PHPickerViewController *)picker didFinishPicking:(NSArrayPHPickerResult * *)results { PHPickerResult *result = [results firstObject]; if (result) { [result.itemProvider loadObjectOfClass:[UIImage class] completionHandler:^(__kindof idNSItemProvide
1
0
1.4k
Mar ’21
Load video from PHPhotoPicker without photo library permissions?
The sample code - https://developer.apple.com/documentation/photokit/selecting_photos_and_videos_in_ios for PHPhotoPicker doesn't include an example of how to load a video. I got it working by using the PHPickerResult’s assetIdentifier and PHAsset.fetchAssets(withLocalIdentifiers:options:), but that requires additional photo library permissions. How can I load a movie directly from the PHPickerResult?
10
0
9.5k
Dec ’20
PHPhotoLibrary presentLimitedLibraryPicker dismiss event
Hi All, I am using the limited library feature. I am using presentLimitedLibraryPicker to show the user about the limited photos selections. I would like to capture the event in case the user does not make any modifications to the existing limited photos selection and selects ok / cancel. Please let me know if there is any way to capture this.
1
0
943
Nov ’20
Photo Library - How to handle limited access
Hello everybody, For the last couple of days I have been struggling with preparing my app to limited access to the Photo Library. I want the user to be able to choose limited access. In my app I need to be able to access the photo, as well as, photo metadata like - creation date and location (if available). Before showing the picker, I am asking the user for authorisation to access the Photo Library, like this. let accessLevel: PHAccessLevel = .readWrite let status = PHPhotoLibrary.authorizationStatus(for: accessLevel) switch status { case .authorized: self.imagePickerIsPresented.toggle() case .limited: print(Limited access - show picker.) self.imagePickerIsPresented.toggle() case .denied: self.showPhotosAccessDeniedAlert.toggle() case .notDetermined: PHPhotoLibrary.requestAuthorization(for: accessLevel) { newStatus in switch newStatus { case .limited: print(Limited access.) break case .authorized: print(Full access.) case .denied: break default: break } } default: break } I have used breakpoints to debug thi
2
0
7.3k
Nov ’20
Why is there an error when loading livePhoto in PHPicker without the photo library premissions?
hello,I am trying to figure out how to get livePhoto、gif and the picture on the icloud in PHPicker without the Photo Library permissions, but I get the error message like this : 2020-07-10 20:38:42.314255+0800 NewsInHouse[1307:315714] error = Error Domain=NSItemProviderErrorDomain Code=-1000 Cannot load representation of type com.apple.live-photo-bundle UserInfo={NSLocalizedDescription=Cannot load representation of type com.apple.live-photo-bundle, NSUnderlyingError=0x282049680 {Error Domain=NSCocoaErrorDomain Code=260 未能打开文件“7B1C8EE4-4A3E-4287-9369-8592943BC4AD.pvt”,因为它不存在。 UserInfo={NSURL=file:///private/var/mobile/Containers/Shared/AppGroup/3343D5E0-FD07-49AB-9131-3DADE85A46DC/File%20Provider%20Storage/7B1C8EE4-4A3E-4287-9369-8592943BC4AD.pvt, NSFilePath=/private/var/mobile/Containers/Shared/AppGroup/3343D5E0-FD07-49AB-9131-3DADE85A46DC/File Provider Storage/7B1C8EE4-4A3E-4287-9369-8592943BC4AD.pvt, NSUnderlyingError=0x2820042d0 {Error Domain=NSPOSIXErrorDomain Code=2 No such file or directory}}}} 2020-07-
2
0
2.4k
Oct ’20
How can i display only limited photos with PHPickerViewController?
Hello everyone! I use Limited Photos Library feature and have selected a few photo but when use PHPickerViewController to select images in the application, PHPickerViewController shows all images in the gallery instead of just a few selected ones before. Is it possible to display only pre-selected images in PHPickerViewController? If not, how to display a list of pre-selected images so that the user can choose as UIImagePickerController before. Thanks to everyone for sharing and commenting ミ★(=^・・^)v Thanks!!★彡
4
0
3.9k
Oct ’20