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

Posts under Media tag

200 Posts

Post

Replies

Boosts

Views

Activity

Video with different audio and video durations for HLS playback
I am trying to generate ABR manifest for a video that has a slightly longer video stream than audio stream. Running mediastreamvalidator tool on the manifest I get an error "Different content duration detected between discontinuities". I assume it is caused by my generated manifest having video segments extent past the last audio segments in seconds. Should I shorten the video playback to be the shorter between the two? Should I pad out the video with empty segments so that both streams have the same duration?
4
0
1.5k
Mar ’23
AVVideoCompositionCoreAnimationTool and AVAssetExportSession freezes the app randomly
Hi there, So I've been banging my head for the last week, because we have an issue in our app where it's freezing on export while the composition has a AVVideoCompositionCoreAnimationTool as animationTool Before extracting the code to an app I can share, or submit a TSIs, I was wondering if this rings a bell to someone. Basically, we're not doing something too crazy We create an AVAssetExportSession from a composition, some audio and some layers to animate.     func makeExportable(configuration: ExportConfiguration) throws -> AVAssetExportSession {         if let animationLayer {             let rect = CGRect(origin: .zero, size: configuration.videoSize)             let videoAnimationLayer = CALayer()             videoAnimationLayer.frame = rect             let videoLayer = CALayer()             videoLayer.frame = rect             videoAnimationLayer.addSublayer(videoLayer)             videoAnimationLayer.addSublayer(animationLayer)             videoAnimationLayer.isGeometryFlipped = true             let animationTool = AVVideoCompositionCoreAnimationTool(postProcessingAsVideoLayer: videoLayer,                                                                     in: videoAnimationLayer)             avVideoComposition.animationTool = animationTool         }         guard             let session = AVAssetExportSession(asset: avComposition,                                                presetName: configuration.avAssetExportPresetName) else {             throw CompositionError.invalidExportSession         }         session.audioMix = audioMix         session.videoComposition = avVideoComposition         return session)     } Then we run await session.export() If we do that multiple times in a row (there are no specific triggers, I can have a 3s video with 40 CALayers or a 30s with 1500 layers, it could happen on the first export or the 20th, ...), then at some point, the app will just have a severe hang with the following stack trace (if I pause the debug session). If ever, I remove the avVideoComposition.animationTool = animationTool line from the export session creation, then the app does not hang... Also, I encounter the issue with the fact that it's crashing on a sim but running fine on a device. Some api_misuse crash (see [here)]. Could this be related, idk...(https://developer.apple.com/forums/thread/133681) Anyway... Completely stuck here, and surprised that such a thing would have an issue on AVFoundation. We're probably not the onliest using CoreAnimation on a video export... Thanks! Marian
4
4
1.9k
Mar ’23
I can’t save a large video on my iPhone
The problem is, I have a video file which is about 111MB with resolution 1216x2160 aaaand I can’t save it on my iPhone even though I have a plenty enough space 😭 I tried to send it via airdrop and it shows a pop up with an error and ask me if I want to save it in my documents (I tried this one as well and there’s no way to save it in my gallery from the app), I tried to send a file via telegram and also get the same error. What should I do? I can’t believe that I can shoot in 4K, but can’t save a video with a higher resolution on my iPhone
1
0
2.1k
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
1
0
1.2k
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.8k
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
852
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
831
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
970
Nov ’22
Video with different audio and video durations for HLS playback
I am trying to generate ABR manifest for a video that has a slightly longer video stream than audio stream. Running mediastreamvalidator tool on the manifest I get an error "Different content duration detected between discontinuities". I assume it is caused by my generated manifest having video segments extent past the last audio segments in seconds. Should I shorten the video playback to be the shorter between the two? Should I pad out the video with empty segments so that both streams have the same duration?
Replies
4
Boosts
0
Views
1.5k
Activity
Mar ’23
AVVideoCompositionCoreAnimationTool and AVAssetExportSession freezes the app randomly
Hi there, So I've been banging my head for the last week, because we have an issue in our app where it's freezing on export while the composition has a AVVideoCompositionCoreAnimationTool as animationTool Before extracting the code to an app I can share, or submit a TSIs, I was wondering if this rings a bell to someone. Basically, we're not doing something too crazy We create an AVAssetExportSession from a composition, some audio and some layers to animate.     func makeExportable(configuration: ExportConfiguration) throws -> AVAssetExportSession {         if let animationLayer {             let rect = CGRect(origin: .zero, size: configuration.videoSize)             let videoAnimationLayer = CALayer()             videoAnimationLayer.frame = rect             let videoLayer = CALayer()             videoLayer.frame = rect             videoAnimationLayer.addSublayer(videoLayer)             videoAnimationLayer.addSublayer(animationLayer)             videoAnimationLayer.isGeometryFlipped = true             let animationTool = AVVideoCompositionCoreAnimationTool(postProcessingAsVideoLayer: videoLayer,                                                                     in: videoAnimationLayer)             avVideoComposition.animationTool = animationTool         }         guard             let session = AVAssetExportSession(asset: avComposition,                                                presetName: configuration.avAssetExportPresetName) else {             throw CompositionError.invalidExportSession         }         session.audioMix = audioMix         session.videoComposition = avVideoComposition         return session)     } Then we run await session.export() If we do that multiple times in a row (there are no specific triggers, I can have a 3s video with 40 CALayers or a 30s with 1500 layers, it could happen on the first export or the 20th, ...), then at some point, the app will just have a severe hang with the following stack trace (if I pause the debug session). If ever, I remove the avVideoComposition.animationTool = animationTool line from the export session creation, then the app does not hang... Also, I encounter the issue with the fact that it's crashing on a sim but running fine on a device. Some api_misuse crash (see [here)]. Could this be related, idk...(https://developer.apple.com/forums/thread/133681) Anyway... Completely stuck here, and surprised that such a thing would have an issue on AVFoundation. We're probably not the onliest using CoreAnimation on a video export... Thanks! Marian
Replies
4
Boosts
4
Views
1.9k
Activity
Mar ’23
Can it auto choose don't import apply to all duplicates in Apple Script
I was trying to write a script that can automatically import new photos in to the Photoslibrary, in AppleScript, there are only bool value to determine whether check duplicates, is there a way to do like " check and always do not import duplicate items "
Replies
1
Boosts
0
Views
924
Activity
Mar ’23
I can’t save a large video on my iPhone
The problem is, I have a video file which is about 111MB with resolution 1216x2160 aaaand I can’t save it on my iPhone even though I have a plenty enough space 😭 I tried to send it via airdrop and it shows a pop up with an error and ask me if I want to save it in my documents (I tried this one as well and there’s no way to save it in my gallery from the app), I tried to send a file via telegram and also get the same error. What should I do? I can’t believe that I can shoot in 4K, but can’t save a video with a higher resolution on my iPhone
Replies
1
Boosts
0
Views
2.1k
Activity
Feb ’23
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
759
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.2k
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.8k
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
1k
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.8k
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
852
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
831
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
970
Activity
Nov ’22