Integrate photo, audio, and video content into your apps.

Posts under Media tag

200 Posts

Post

Replies

Boosts

Views

Activity

Help Understanding iMessage Network Traffic
This is probably a long shot but I thought I'd give it a try. We have remote offices that are very remote -- as in satellite internet connections. Our vendor has bandwidth caps which if hit, cause a huge problem. We want employees to be able to use the internet when not working but we are trying to limit certain types of traffic. Through our UTM firewall, we are able to block iCloud backups which helps. However, we cannot figure out a way to block the syncing of photos/videos via the photos app. If we block all traffic to iCloud, iMessage will not deliver photos. Ideally, we want to block the iCloud backup and photo sync but still allow people to send individual photos/videos via iMessage. We've done packet captures but most of the traffic is obviously encrypted. It appears that if we just block gateway.icloud.com, photo sync will stop but iMessage will work for text only messages. However, photos embedded in iMessages will not go. Does anyone know if there is a way to isolate these different services through FQDN's, ports, etc...? Thanks much. Hopefully someone has been through this before. Our firewall vendor cant do much as it appears we need to have a better understanding of how iMessage works. -dave
1
0
1.1k
Jan ’23
Unable to update the MPMediaItem (Lock Screen Media Controls)
I'm currently developing an app that can reproduce audio and video from the web (my own server) using SwiftUI targeting iOS15 and testing on a iPhone XS Pro Max running iOS16.2 (real device) Both the video and audio play just fine but I get this (image in the end of the post) in as the media controls. The current time and duration are correct and updated (without me calling to update them) but I'm unable to actually update the title, artist, album and artwork My first thought was to update the NowPlaying and after a lengthy search I'm yet to find a solution that works I created a small class to update the NowPlaying info import Foundation import UIKit import MediaPlayer public class MediaController {     var nowPlayingInfo = [String: Any]()     static let shared = MediaController()     private init() { }     func setupNotificationView(title: String?, album: String?, artist: String?, thumbnailUrl: String) {         nowPlayingInfo = [String : Any]()         nowPlayingInfo[MPMediaItemPropertyTitle] = title         nowPlayingInfo[MPMediaItemPropertyAlbumTitle] = album         nowPlayingInfo[MPMediaItemPropertyArtist] = artist MPNowPlayingInfoCenter.default().nowPlayingInfo = nowPlayingInfo     } } The NowPlaying still doesn't update This is the call sequence when I press play let avAsset = AVURLAsset(url: URL(string: "https://domain.com/video.mp4") let avItem = AVPlayerItem(asset: avAsset) player.replaceCurrentItem(with: avItem) do { try AVAudioSession.sharedInstance().setActive(true); } catch { print(error) } player.play() MediaController.shared.setupNotificationView(title: "A Title", album: "A Album", artist: "A Artist", thumbnailUrl: "") Although the app is being developed using SwiftUI I'm using the UIViewControllerRepresentable to display a the video using AVPlayerViewController since the current one misses the PiP and under makeUIViewController I have the following code let controller = AVPlayerViewController() controller.player = player controller.allowsPictureInPicturePlayback = true controller.entersFullScreenWhenPlaybackBegins = true controller.delegate = context.coordinator and on the app launch I have the following let audioSession = AVAudioSession.sharedInstance() do { try audioSession.setCategory(AVAudioSession.Category.playback) } catch { print("Setting category to AVAudioSessionCategoryPlayback failed.") } And yes I have the background mode capability enabled for "Audio, AirPlay and Picture in Picture" I'm at a lost here and hope someone can help.
2
0
1.9k
Dec ’22
VTT Special Characters not displaying properly sometimes
When choosing to display a foreign audio track on some videos, the text does not render correctly. instead of a musical note I see white boxes for instance. This issue does not occur for the same content on Safari for Mac or Safari for iPad. The issue does present itself for a native mobile app (AVPlayer) on the same iPad, Safari for iPhone and the native mobile app on iPhone. Below is an image of the issue, the left is what I see on a problematic device and the right is what I would expect. Are there any known issues or workaround for this?
0
0
1.5k
Dec ’22
Xcode SwiftUI video editing splash screen
Hi, I'm trying to create our app splash screen which I need a video to play in the background. I've currently got the video into my project under the following code with AV kit/foundation imported:     VideoPlayer(player: AVPlayer(url: Bundle.main.url(forResource: "XXXXXX", withExtension: "mp4")!))       .frame(height: 400)       But I need to complete three tasks: Make the video full screen Remove the player buttons Play the video automatically All resources online seem outdated and don't work on Xcode 14. Any help from a pro would be greatly appreciated! Thanks
2
0
1.5k
Dec ’22
Autoplay working in Chrome but not in Safari. WHY!?!?!
Searched and searched can't find a solution. (yes I changed the settings in safari) I'm using Joomla 4 autoplay is working in Chrome perfect, but in safari not also looked up my code and got the required lines from the Apple Developer page, but it is still not working <p> <video src="images/video/A-Vid.webm" autoplay="autoplay" loop="loop" muted="muted" width="560" height="315" playsinline="playsinline" id="bgvid"><source src="images/video/A-Vid.mp4" type="video/mp4" /></video> </p>
2
0
2.6k
Dec ’22
AVPlayer audio issue on iOS 16
I'm using AVPlayer to play a video. It is working as expected on iOS 15 but there's no audio on iOS 16. The video is playing without any interruption. It just the audio. Used this code to make sure that phone isn't on silent mode. do { try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default, options: [])  } catch { print("Setting category to AVAudioSessionCategoryPlayback failed.") } Any help would be appreciated.
5
4
3.1k
Dec ’22
In search of an AVVideoSourceNode
The first few lines of this code generate audio noise of arbitrary length. What would be the equivalent for generation of uncompressed video noise (analog tv static)? import AVFoundation let srcNode = AVAudioSourceNode { _, _, frameCount, bufferList in     for frame in 0..<Int(frameCount) {         let buf: UnsafeMutableBufferPointer<Float> = UnsafeMutableBufferPointer(bufferList.pointee.mBuffers)         buf[frame] = Float.random(in: -1...1)     }     return noErr } let engine = AVAudioEngine() let output = engine.outputNode let format = output.inputFormat(forBus: 0) engine.attach(srcNode) engine.connect(srcNode, to: output, format: format) try? engine.start() CFRunLoopRunInMode(.defaultMode, CFTimeInterval(5.0), false) engine.stop()
0
0
1.7k
Nov ’22
how to save video into an User Album with PHPhotoLibrary, PHAsset
Hello, I want to save the video file into a specific USER Album named "Cambox Album". Actually only works into the default Album in recent assets with the true new name nameX.mov. Below the code for define the PathDirectory : func getDirectoryPath() -> String {         let nsDocumentDirectory = FileManager.SearchPathDirectory.documentDirectory         let paths = NSSearchPathForDirectoriesInDomains(nsDocumentDirectory, .userDomainMask, true)         let documentsDirectory = paths[0]         return documentsDirectory     }     with this code below, the video is automatically saved in the default user album. func downloadVideo(urlVideo : URL! ) {         DispatchQueue.global(qos: .background).async {             if let url = urlVideo, let urlData = NSData(contentsOf: url) {                 let galleryPath = self.getDirectoryPath()                 let filePath = galleryPath + "/nameX.mov"               DispatchQueue.main.async {                 urlData.write(toFile: filePath, atomically: true)                    PHPhotoLibrary.shared().performChanges({                    PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL:                    URL(fileURLWithPath: filePath))                 }) {success, error in                  if success {                        let alertController = UIAlertController(title: "Your video was successfully saved", message: nil, preferredStyle: .alert)                        let defaultAction = UIAlertAction(title: "OK", style: .default, handler: nil ) alertController.addAction(defaultAction)                        self.present(alertController, animated: true, completion: nil)                    } else {                        let alertController = UIAlertController(title: error?.localizedDescription, message: nil, preferredStyle: .alert)                       let defaultAction = UIAlertAction(title: "ERROR !", style: .default, handler: nil)                        alertController.addAction(defaultAction)                        self.present(alertController, animated: true, completion: nil)                    }                 }              }           }        }     } if I replace the line with the name of the album by : let filePath = galleryPath + "/Cambox Album/nameX.mov" nothing happened, I can't see the video anywhere ! is there anybody who can help me to resolve this issue please ? Regards
0
0
1.2k
Nov ’22
How to save video in user album ?
hey, severals hours for searching a solution without success... i want to save a URL video into a specific User Album and unfortunatly nothing happen ! if I define only the new name of the video (without the urlpath), I can find the video in the recent album ! anybody have an idea what 's happen ? please see below example of my code        let galleryPath = self.getDirectoryPath() print ("######### value of galleryPath  : (String(describing: galleryPath))")                 let filePath = galleryPath + "/nameX.mov"                 print ("######### value of filePath  : (String(describing: filePath))")               DispatchQueue.main.async {                 urlData.write(toFile: filePath, atomically: true)                    PHPhotoLibrary.shared().performChanges({                    PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL:                    URL(fileURLWithPath: filePath))                 }) {                    success, error in                    if success {                       print("Succesfully Saved")                    } else {                       print(error?.localizedDescription)                    }                 }              } Many thanks for your help ! JM
0
0
849
Nov ’22
Modify playlist with MPMediaPlaylist
Hi, is there anyway to edit playlist song(s) and edit playlist name with MPMediaPlaylist Api? Hope can get the answer to implement this function. thank you. From the Apple documentation, it only provide func  addItem ( withProductID : String,  completionHandler : ((Error?) -> Void)?) and func add([MPMediaItem], completionHandler: ((Error?) -> Void)?)
0
1
827
Nov ’22
IOS 16.1.1 Car connectivity issue
i used to stream music in my car through apps like spotify and it used to be fine showing song info and the album art. Recently after the last update its not showing anything in the car infotainment system wether the song info or the album art. I tried connecting through the usb cable but it couldn’t show anything and sometimes am not even able to skip a song from the car multimedia controls. Its worth noting that finally i tried the apple music app and that is the only one that works fine but not perfect also as before as sometime not showing accurate info. This is frustrating and its very weird because it used to work perfectly before and that is a very simple task that we use everyday. Its also worth noting that i tried connecting with other iphones of previous models and its working so its software issue. Please if there is a fix for that it will be highly appreciated. iphone model: 13 Pro Max ios version: 16.1.1 Car model: BMW 2015 with NBT idrive System
1
0
965
Nov ’22
Can't save lots of photos in camera roll since iOS 16 (error message)
Hi there, Since iOS 16, i am not able to save more than 10 photos (sometimes more, sometimes less) via the UIActivityController's "Saves X images" feature. Usually, on iOS 15, i was able to retrieve all the photos in one go (by giving all the URLs to the UIActivityController) and save it to the camera roll. But now, i have this unknown error message : Error Domain=ALAssetsLibraryErrorDomain Code=-1 "Unknown error" UserInfo={NSLocalizedDescription=Unknown error, NSUnderlyingError=0x281852250 {Error Domain=PHPhotosErrorDomain Code=3301 "(null)"}} Note that there are some DNG format photos in there (high quality) but it used to work perfectly until now. I cannot find anything on this subject, does it ring a bell to anyone ? If you need more infos, i am available, Thanks in advance !
2
0
1.1k
Nov ’22
PHPhotoPicker Albums
Hi devs, I am writing my firsts app in SwiftUI and there are lots of things to learn. In going for SwiftUI I am implementing some of the newer controls such as PHPhotoPicker (iOS 14+) which is permissioned dynamically by the user selecting content. However, in the picker I would like the user to be able to see all their albums. Currently they see only the following: Videos Selfies Time-Lapse Slo-Mo Cinematic Screen Recordings Import Hidden So is there any way to show for instance the album?, without reverting to an older picker view. Thank you in advance to anyone who might know a way to enact this…
2
0
1.3k
Nov ’22
AVSampleBufferDisplayLayer freezes UI on init
Hello, I am seeing an issue in my app where creating instances of AVSampleBufferDisplayLayer from AVFoundation is freezing the main UI in some circumstances for more than 5 seconds. Is there any workarounds for this?  I have not been able to reproduce this myself though. I am creating all instances of this class on the main thread. Here is the stack trace that is being logged. 0 libsystem_kernel.dylib:mach_msg_trap (in libsystem_kernel.dylib) + 8 1 MediaToolbox:FigVideoQueueRemoteClient_Create (in MediaToolbox) + 200 2 MediaToolbox:__FigVideoQueueCreateRemote_block_invoke (in MediaToolbox) + 100 3 CoreMedia:FigRPCCreateServerConnectionForObject (in CoreMedia) + 508 4 MediaToolbox:FigVideoQueueCreateRemote (in MediaToolbox) + 300 5 AVFCore:__49-[AVSampleBufferVideoRenderer _createVideoQueue:]_block_invoke (in AVFCore) + 48 6 libdispatch.dylib:_dispatch_client_callout (in libdispatch.dylib) + 20 7 libdispatch.dylib:_dispatch_lane_barrier_sync_invoke_and_complete (in libdispatch.dylib) + 56 8 AVFCore:-[AVSampleBufferVideoRenderer _createVideoQueue:] (in AVFCore) + 164 9 AVFCore:-[AVSampleBufferVideoRenderer init] (in AVFCore) + 528 10 AVFCore:-[AVSampleBufferDisplayLayer init] (in AVFCore) + 280 11 MyApplication:-[PlaybackView initWithFrame:] (in MyApplication) (PlaybackView.m:56) 12 MyApplication:__62-[CustomPlayer setupVideoDisplayLayerWithCompletion:]_block_invoke (in MyApplication) (CustomPlayer.m:730) 13 libdispatch.dylib:_dispatch_call_block_and_release (in libdispatch.dylib) + 32 14 libdispatch.dylib:_dispatch_client_callout (in libdispatch.dylib) + 20 15 libdispatch.dylib:_dispatch_main_queue_drain (in libdispatch.dylib) + 928 16 libdispatch.dylib:_dispatch_main_queue_callback_4CF (in libdispatch.dylib) + 44 17 CoreFoundation:__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ (in CoreFoundation) + 16 18 CoreFoundation:__CFRunLoopRun (in CoreFoundation) + 2532 19 CoreFoundation:CFRunLoopRunSpecific (in CoreFoundation) + 600 20 GraphicsServices:GSEventRunModal (in GraphicsServices) + 164 21 UIKitCore:-[UIApplication _run] (in UIKitCore) + 1100 22 UIKitCore:UIApplicationMain (in UIKitCore) + 364 23 LinkedIn:main (in LinkedIn) (main.m:37) 24 ???:24 ??? 0x000000010877dda4 0x0 + 0
2
0
1.3k
Nov ’22
How to sync video and audio?
Background I use AVAssetWriterInput.append to append sample buffer to the writer. Sometimes, I switch off the audio input(if user wants to temporarily disable audio input), so the append method will not be executed while the append method in video input will always be executed. Problem If user pause the audio and resume it later. The audio after resuming will immediately begin when user pause it (in the final video). Example '=' refers to CMSampleBuffer. '|' means user paused the audio input. Video: ---------------================================= Audio(expected): ----=======|----------------============= Audio(I got): ---------=======|=============---------------- I have printed the presentationTime from the audio sample buffer, it turns out it's correct. Maybe my understanding to the AVAssetWriterInput.append is wrong? My current solution is to always append the buffer, but when user wants to pause, I simply append an empty SampleBuffer filled with nothing. I don't think this is the best way to deal with it. Is there any idea to sync the buffer time with the video??
1
0
1.3k
Nov ’22
AVAsset return false for `isPlayable` on iOS, true on macOS. AVExportSession.export fails with error -16976.
I'm testing on iOS 16.2 and macOS 13.1 The mp4 video was created as a QuickTime screen recording on macOS Monterey. Sample code reproducing the isPlayable bug: https://github.com/ronyfadel/AV-Test-App
Replies
1
Boosts
0
Views
1.1k
Activity
Feb ’23
photo library issues
How come the photos I took with camera is not separated with those pics I got from the apps?they were all in “recent”,what’s more annoying is that when I try to categorize them by moving them into a new album, the original pics were still in the “recent”. I don’t even know weather the pics were categorized at all. Can you improve it pls?
Replies
0
Boosts
0
Views
755
Activity
Feb ’23
Help Understanding iMessage Network Traffic
This is probably a long shot but I thought I'd give it a try. We have remote offices that are very remote -- as in satellite internet connections. Our vendor has bandwidth caps which if hit, cause a huge problem. We want employees to be able to use the internet when not working but we are trying to limit certain types of traffic. Through our UTM firewall, we are able to block iCloud backups which helps. However, we cannot figure out a way to block the syncing of photos/videos via the photos app. If we block all traffic to iCloud, iMessage will not deliver photos. Ideally, we want to block the iCloud backup and photo sync but still allow people to send individual photos/videos via iMessage. We've done packet captures but most of the traffic is obviously encrypted. It appears that if we just block gateway.icloud.com, photo sync will stop but iMessage will work for text only messages. However, photos embedded in iMessages will not go. Does anyone know if there is a way to isolate these different services through FQDN's, ports, etc...? Thanks much. Hopefully someone has been through this before. Our firewall vendor cant do much as it appears we need to have a better understanding of how iMessage works. -dave
Replies
1
Boosts
0
Views
1.1k
Activity
Jan ’23
Unable to update the MPMediaItem (Lock Screen Media Controls)
I'm currently developing an app that can reproduce audio and video from the web (my own server) using SwiftUI targeting iOS15 and testing on a iPhone XS Pro Max running iOS16.2 (real device) Both the video and audio play just fine but I get this (image in the end of the post) in as the media controls. The current time and duration are correct and updated (without me calling to update them) but I'm unable to actually update the title, artist, album and artwork My first thought was to update the NowPlaying and after a lengthy search I'm yet to find a solution that works I created a small class to update the NowPlaying info import Foundation import UIKit import MediaPlayer public class MediaController {     var nowPlayingInfo = [String: Any]()     static let shared = MediaController()     private init() { }     func setupNotificationView(title: String?, album: String?, artist: String?, thumbnailUrl: String) {         nowPlayingInfo = [String : Any]()         nowPlayingInfo[MPMediaItemPropertyTitle] = title         nowPlayingInfo[MPMediaItemPropertyAlbumTitle] = album         nowPlayingInfo[MPMediaItemPropertyArtist] = artist MPNowPlayingInfoCenter.default().nowPlayingInfo = nowPlayingInfo     } } The NowPlaying still doesn't update This is the call sequence when I press play let avAsset = AVURLAsset(url: URL(string: "https://domain.com/video.mp4") let avItem = AVPlayerItem(asset: avAsset) player.replaceCurrentItem(with: avItem) do { try AVAudioSession.sharedInstance().setActive(true); } catch { print(error) } player.play() MediaController.shared.setupNotificationView(title: "A Title", album: "A Album", artist: "A Artist", thumbnailUrl: "") Although the app is being developed using SwiftUI I'm using the UIViewControllerRepresentable to display a the video using AVPlayerViewController since the current one misses the PiP and under makeUIViewController I have the following code let controller = AVPlayerViewController() controller.player = player controller.allowsPictureInPicturePlayback = true controller.entersFullScreenWhenPlaybackBegins = true controller.delegate = context.coordinator and on the app launch I have the following let audioSession = AVAudioSession.sharedInstance() do { try audioSession.setCategory(AVAudioSession.Category.playback) } catch { print("Setting category to AVAudioSessionCategoryPlayback failed.") } And yes I have the background mode capability enabled for "Audio, AirPlay and Picture in Picture" I'm at a lost here and hope someone can help.
Replies
2
Boosts
0
Views
1.9k
Activity
Dec ’22
Support for Opus in MP4 support
Opus is already supported in the .caf container format, however, it is not supported in .mp4. Opus is used heavily across the board so I often come across mp4s that don’t have audio on iOS and Safari. Implementation document: https://opus-codec.org/docs/opus_in_isobmff.html
Replies
0
Boosts
1
Views
1.7k
Activity
Dec ’22
VTT Special Characters not displaying properly sometimes
When choosing to display a foreign audio track on some videos, the text does not render correctly. instead of a musical note I see white boxes for instance. This issue does not occur for the same content on Safari for Mac or Safari for iPad. The issue does present itself for a native mobile app (AVPlayer) on the same iPad, Safari for iPhone and the native mobile app on iPhone. Below is an image of the issue, the left is what I see on a problematic device and the right is what I would expect. Are there any known issues or workaround for this?
Replies
0
Boosts
0
Views
1.5k
Activity
Dec ’22
Accessing photo library personas
My goal is to access the photo library personas. I've looked through the PhotoKit documentation and did some research but I couldn't find any explanation on how to achieve that. So is this even possible?
Replies
3
Boosts
2
Views
1.1k
Activity
Dec ’22
Support of clipboard in iOS
The “best” phone in the world really misses the clipboard function, so you can access copied data stack including images. Absence of this feature makes it really uncomfortable to fill the templates or accessing some data from previous activity without reopening the previous activity app.
Replies
0
Boosts
0
Views
914
Activity
Dec ’22
Xcode SwiftUI video editing splash screen
Hi, I'm trying to create our app splash screen which I need a video to play in the background. I've currently got the video into my project under the following code with AV kit/foundation imported:     VideoPlayer(player: AVPlayer(url: Bundle.main.url(forResource: "XXXXXX", withExtension: "mp4")!))       .frame(height: 400)       But I need to complete three tasks: Make the video full screen Remove the player buttons Play the video automatically All resources online seem outdated and don't work on Xcode 14. Any help from a pro would be greatly appreciated! Thanks
Replies
2
Boosts
0
Views
1.5k
Activity
Dec ’22
Autoplay working in Chrome but not in Safari. WHY!?!?!
Searched and searched can't find a solution. (yes I changed the settings in safari) I'm using Joomla 4 autoplay is working in Chrome perfect, but in safari not also looked up my code and got the required lines from the Apple Developer page, but it is still not working <p> <video src="images/video/A-Vid.webm" autoplay="autoplay" loop="loop" muted="muted" width="560" height="315" playsinline="playsinline" id="bgvid"><source src="images/video/A-Vid.mp4" type="video/mp4" /></video> </p>
Replies
2
Boosts
0
Views
2.6k
Activity
Dec ’22
AVPlayer audio issue on iOS 16
I'm using AVPlayer to play a video. It is working as expected on iOS 15 but there's no audio on iOS 16. The video is playing without any interruption. It just the audio. Used this code to make sure that phone isn't on silent mode. do { try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default, options: [])  } catch { print("Setting category to AVAudioSessionCategoryPlayback failed.") } Any help would be appreciated.
Replies
5
Boosts
4
Views
3.1k
Activity
Dec ’22
In search of an AVVideoSourceNode
The first few lines of this code generate audio noise of arbitrary length. What would be the equivalent for generation of uncompressed video noise (analog tv static)? import AVFoundation let srcNode = AVAudioSourceNode { _, _, frameCount, bufferList in     for frame in 0..<Int(frameCount) {         let buf: UnsafeMutableBufferPointer<Float> = UnsafeMutableBufferPointer(bufferList.pointee.mBuffers)         buf[frame] = Float.random(in: -1...1)     }     return noErr } let engine = AVAudioEngine() let output = engine.outputNode let format = output.inputFormat(forBus: 0) engine.attach(srcNode) engine.connect(srcNode, to: output, format: format) try? engine.start() CFRunLoopRunInMode(.defaultMode, CFTimeInterval(5.0), false) engine.stop()
Replies
0
Boosts
0
Views
1.7k
Activity
Nov ’22
how to save video into an User Album with PHPhotoLibrary, PHAsset
Hello, I want to save the video file into a specific USER Album named "Cambox Album". Actually only works into the default Album in recent assets with the true new name nameX.mov. Below the code for define the PathDirectory : func getDirectoryPath() -> String {         let nsDocumentDirectory = FileManager.SearchPathDirectory.documentDirectory         let paths = NSSearchPathForDirectoriesInDomains(nsDocumentDirectory, .userDomainMask, true)         let documentsDirectory = paths[0]         return documentsDirectory     }     with this code below, the video is automatically saved in the default user album. func downloadVideo(urlVideo : URL! ) {         DispatchQueue.global(qos: .background).async {             if let url = urlVideo, let urlData = NSData(contentsOf: url) {                 let galleryPath = self.getDirectoryPath()                 let filePath = galleryPath + "/nameX.mov"               DispatchQueue.main.async {                 urlData.write(toFile: filePath, atomically: true)                    PHPhotoLibrary.shared().performChanges({                    PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL:                    URL(fileURLWithPath: filePath))                 }) {success, error in                  if success {                        let alertController = UIAlertController(title: "Your video was successfully saved", message: nil, preferredStyle: .alert)                        let defaultAction = UIAlertAction(title: "OK", style: .default, handler: nil ) alertController.addAction(defaultAction)                        self.present(alertController, animated: true, completion: nil)                    } else {                        let alertController = UIAlertController(title: error?.localizedDescription, message: nil, preferredStyle: .alert)                       let defaultAction = UIAlertAction(title: "ERROR !", style: .default, handler: nil)                        alertController.addAction(defaultAction)                        self.present(alertController, animated: true, completion: nil)                    }                 }              }           }        }     } if I replace the line with the name of the album by : let filePath = galleryPath + "/Cambox Album/nameX.mov" nothing happened, I can't see the video anywhere ! is there anybody who can help me to resolve this issue please ? Regards
Replies
0
Boosts
0
Views
1.2k
Activity
Nov ’22
How to save video in user album ?
hey, severals hours for searching a solution without success... i want to save a URL video into a specific User Album and unfortunatly nothing happen ! if I define only the new name of the video (without the urlpath), I can find the video in the recent album ! anybody have an idea what 's happen ? please see below example of my code        let galleryPath = self.getDirectoryPath() print ("######### value of galleryPath  : (String(describing: galleryPath))")                 let filePath = galleryPath + "/nameX.mov"                 print ("######### value of filePath  : (String(describing: filePath))")               DispatchQueue.main.async {                 urlData.write(toFile: filePath, atomically: true)                    PHPhotoLibrary.shared().performChanges({                    PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL:                    URL(fileURLWithPath: filePath))                 }) {                    success, error in                    if success {                       print("Succesfully Saved")                    } else {                       print(error?.localizedDescription)                    }                 }              } Many thanks for your help ! JM
Replies
0
Boosts
0
Views
849
Activity
Nov ’22
Modify playlist with MPMediaPlaylist
Hi, is there anyway to edit playlist song(s) and edit playlist name with MPMediaPlaylist Api? Hope can get the answer to implement this function. thank you. From the Apple documentation, it only provide func  addItem ( withProductID : String,  completionHandler : ((Error?) -> Void)?) and func add([MPMediaItem], completionHandler: ((Error?) -> Void)?)
Replies
0
Boosts
1
Views
827
Activity
Nov ’22
IOS 16.1.1 Car connectivity issue
i used to stream music in my car through apps like spotify and it used to be fine showing song info and the album art. Recently after the last update its not showing anything in the car infotainment system wether the song info or the album art. I tried connecting through the usb cable but it couldn’t show anything and sometimes am not even able to skip a song from the car multimedia controls. Its worth noting that finally i tried the apple music app and that is the only one that works fine but not perfect also as before as sometime not showing accurate info. This is frustrating and its very weird because it used to work perfectly before and that is a very simple task that we use everyday. Its also worth noting that i tried connecting with other iphones of previous models and its working so its software issue. Please if there is a fix for that it will be highly appreciated. iphone model: 13 Pro Max ios version: 16.1.1 Car model: BMW 2015 with NBT idrive System
Replies
1
Boosts
0
Views
965
Activity
Nov ’22
Can't save lots of photos in camera roll since iOS 16 (error message)
Hi there, Since iOS 16, i am not able to save more than 10 photos (sometimes more, sometimes less) via the UIActivityController's "Saves X images" feature. Usually, on iOS 15, i was able to retrieve all the photos in one go (by giving all the URLs to the UIActivityController) and save it to the camera roll. But now, i have this unknown error message : Error Domain=ALAssetsLibraryErrorDomain Code=-1 "Unknown error" UserInfo={NSLocalizedDescription=Unknown error, NSUnderlyingError=0x281852250 {Error Domain=PHPhotosErrorDomain Code=3301 "(null)"}} Note that there are some DNG format photos in there (high quality) but it used to work perfectly until now. I cannot find anything on this subject, does it ring a bell to anyone ? If you need more infos, i am available, Thanks in advance !
Replies
2
Boosts
0
Views
1.1k
Activity
Nov ’22
PHPhotoPicker Albums
Hi devs, I am writing my firsts app in SwiftUI and there are lots of things to learn. In going for SwiftUI I am implementing some of the newer controls such as PHPhotoPicker (iOS 14+) which is permissioned dynamically by the user selecting content. However, in the picker I would like the user to be able to see all their albums. Currently they see only the following: Videos Selfies Time-Lapse Slo-Mo Cinematic Screen Recordings Import Hidden So is there any way to show for instance the album?, without reverting to an older picker view. Thank you in advance to anyone who might know a way to enact this…
Replies
2
Boosts
0
Views
1.3k
Activity
Nov ’22
AVSampleBufferDisplayLayer freezes UI on init
Hello, I am seeing an issue in my app where creating instances of AVSampleBufferDisplayLayer from AVFoundation is freezing the main UI in some circumstances for more than 5 seconds. Is there any workarounds for this?  I have not been able to reproduce this myself though. I am creating all instances of this class on the main thread. Here is the stack trace that is being logged. 0 libsystem_kernel.dylib:mach_msg_trap (in libsystem_kernel.dylib) + 8 1 MediaToolbox:FigVideoQueueRemoteClient_Create (in MediaToolbox) + 200 2 MediaToolbox:__FigVideoQueueCreateRemote_block_invoke (in MediaToolbox) + 100 3 CoreMedia:FigRPCCreateServerConnectionForObject (in CoreMedia) + 508 4 MediaToolbox:FigVideoQueueCreateRemote (in MediaToolbox) + 300 5 AVFCore:__49-[AVSampleBufferVideoRenderer _createVideoQueue:]_block_invoke (in AVFCore) + 48 6 libdispatch.dylib:_dispatch_client_callout (in libdispatch.dylib) + 20 7 libdispatch.dylib:_dispatch_lane_barrier_sync_invoke_and_complete (in libdispatch.dylib) + 56 8 AVFCore:-[AVSampleBufferVideoRenderer _createVideoQueue:] (in AVFCore) + 164 9 AVFCore:-[AVSampleBufferVideoRenderer init] (in AVFCore) + 528 10 AVFCore:-[AVSampleBufferDisplayLayer init] (in AVFCore) + 280 11 MyApplication:-[PlaybackView initWithFrame:] (in MyApplication) (PlaybackView.m:56) 12 MyApplication:__62-[CustomPlayer setupVideoDisplayLayerWithCompletion:]_block_invoke (in MyApplication) (CustomPlayer.m:730) 13 libdispatch.dylib:_dispatch_call_block_and_release (in libdispatch.dylib) + 32 14 libdispatch.dylib:_dispatch_client_callout (in libdispatch.dylib) + 20 15 libdispatch.dylib:_dispatch_main_queue_drain (in libdispatch.dylib) + 928 16 libdispatch.dylib:_dispatch_main_queue_callback_4CF (in libdispatch.dylib) + 44 17 CoreFoundation:__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ (in CoreFoundation) + 16 18 CoreFoundation:__CFRunLoopRun (in CoreFoundation) + 2532 19 CoreFoundation:CFRunLoopRunSpecific (in CoreFoundation) + 600 20 GraphicsServices:GSEventRunModal (in GraphicsServices) + 164 21 UIKitCore:-[UIApplication _run] (in UIKitCore) + 1100 22 UIKitCore:UIApplicationMain (in UIKitCore) + 364 23 LinkedIn:main (in LinkedIn) (main.m:37) 24 ???:24 ??? 0x000000010877dda4 0x0 + 0
Replies
2
Boosts
0
Views
1.3k
Activity
Nov ’22
How to sync video and audio?
Background I use AVAssetWriterInput.append to append sample buffer to the writer. Sometimes, I switch off the audio input(if user wants to temporarily disable audio input), so the append method will not be executed while the append method in video input will always be executed. Problem If user pause the audio and resume it later. The audio after resuming will immediately begin when user pause it (in the final video). Example '=' refers to CMSampleBuffer. '|' means user paused the audio input. Video: ---------------================================= Audio(expected): ----=======|----------------============= Audio(I got): ---------=======|=============---------------- I have printed the presentationTime from the audio sample buffer, it turns out it's correct. Maybe my understanding to the AVAssetWriterInput.append is wrong? My current solution is to always append the buffer, but when user wants to pause, I simply append an empty SampleBuffer filled with nothing. I don't think this is the best way to deal with it. Is there any idea to sync the buffer time with the video??
Replies
1
Boosts
0
Views
1.3k
Activity
Nov ’22