Posts

Post not yet marked as solved
3 Replies
2.1k Views
Hi all,We are using AVPlayer to play our audio only HLS streams and are seeing what looks like a threading issue with the currentTime() method on AVPlayer vs the times reported by using the periodicTimeObserver.Here's the scenario:1. A class registers as a periodicTimeObserver using 0.1 seconds as the desired time interval.2. Lets say the current time (as reported to the periodic observer) reaches 8.8 seconds.3. On a separate thread, we have the player seek to the currentTime() + 2 seconds.4. Within the completion block of the call to seek, we read & report what the new currentTime() is5. While this is happening, you still listen to the periodicTimeObserver callbacks.6. You'll notice the time reported by the call to currentTime() within the seek completion block is actually AFTER the currentTime() as reported by the periodicTimeObserver.Here it is in code:let underlyingPlayer: AVQueuePlayer = ... underlyingPlayer.seek(to: newPosition, toleranceBefore: kCMTimeZero, toleranceAfter: kCMTimeZero, completionHandler: { [weak self] success in let time = underlyingPlayer.currentTime print("After seeking, the current time is \(time)") completionHandler?(error, time) }) // periodic time observer is set up as the following with an interval of 0.1 seconds let underlyingTimeObservingQueue = DispatchQueue(label: "com.company.player.timeObserver.queue", qos: DispatchQoS.userInitiated) let valueInterval = CMTimeMakeWithSeconds(interval, 1000) return underlyingPlayer.addPeriodicTimeObserver(forInterval: valueInterval, queue: underlyingTimeObservingQueue) { time in print("periodic time is \(CMTimeGetSeconds(time))") return block(CMTimeGetSeconds(time)) } }When you run this, here's the output we receive:periodicTime is 7.701181537periodicTime is 7.801130009periodicTime is 7.900316636periodicTime is 8.000758814periodicTime is 8.100601498periodicTime is 8.201145766periodicTime is 8.301150409periodicTime is 8.401138697periodicTime is 8.501144148periodicTime is 8.601161655periodicTime is 8.701154072periodicTime is 8.800160082After seeking, the current time is 10.88 <----------------- This is the result returned by the seek call's completion blockperiodicTime is 10.736309528periodicTime is 10.736393196periodicTime is 10.801075743periodicTime is 10.900429325periodicTime is 11.000907073periodicTime is 11.100982256periodicTime is 11.201173809periodicTime is 11.300147113periodicTime is 11.401182831periodicTime is 11.500769324periodicTime is 11.600593684periodicTime is 11.701193966periodicTime is 11.800258566periodicTime is 11.900176181periodicTime is 12.000423167This seems like a bug within AVPlayer, but wanted to check here before filing it.We couldn't really find any workarounds for this, but here's what we tried so far:1. Unregistering all periodicTimeObservers right before seeking, and adding them back in the seek completion handler2. Dispatch_sync the call to currentTime() within the seek method's completion blockHowever, none of these solutions fixed the problem.Does anyone have any ideas about what's going on?
Posted
by ronak2121.
Last updated
.
Post not yet marked as solved
0 Replies
310 Views
Hi, I was looking around at the posts about AVAssetResourceLoaderDelegate and HLS audio only streams. I've noticed that once I issue a redirect in the loader delegate, it is never called again...which prevents me from setting my own custom User-Agent header for the rest of the media, or my allowsCellularAccess settings on the urlRequest. What is Apple's recommendation to actually do this properly? Thanks
Posted
by ronak2121.
Last updated
.
Post not yet marked as solved
0 Replies
395 Views
Hi there,Ever since I've upgraded to Xcode 9.4, every test I have for a tvOS target fails due to being unable to load dependent frameworks.Explaining my setup, I'm building a tvOS dynamic framework that depends on other dynamic frameworks. I copy the frameworks into the bundle in the "Copy Files" step of the unit test target. Even then, I get the below errors.These tests used to work just fine on Xcode 9.3 and below. Did something change in Xcode 9.4 that would have affected this?2018-06-07 08:47:07.759784-0400 xctest[2586:14478] The bundle “Networking-tvOSTests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.2018-06-07 08:47:07.759981-0400 xctest[2586:14478] (dlopen_preflight(/Users/myUser/Library/Developer/Xcode/DerivedData/Networking-fvqcarmnxbbcoudwebdojwjthuyy/Build/Products/Debug-appletvsimulator/Networking-tvOSTests.xctest/Networking-tvOSTests): Library not loaded: @rpath/APMetrics.framework/APMetrics Referenced from: /Users/myUser/Library/Developer/Xcode/DerivedData/Networking-fvqcarmnxbbcoudwebdojwjthuyy/Build/Products/Debug-appletvsimulator/Networking.framework/Networking Reason: no suitable image found. Did find: /Users/myUser/Library/Developer/Xcode/DerivedData/Networking-fvqcarmnxbbcoudwebdojwjthuyy/Build/Products/Debug-appletvsimulator/APMetrics.framework/APMetrics: mmap() errno=5 validating first page of '/Users/myUser/Library/Developer/Xcode/DerivedData/Networking-fvqcarmnxbbcoudwebdojwjthuyy/Build/Products/Debug-appletvsimulator/APMetrics.framework/APMetrics' /Users/myUser/Library/Developer/Xcode/DerivedData/Networking-fvqcarmnxbbcoudwebdojwjthuyy/Build/Products/Debug-appletvsimulator/APMetrics.framework/APMetrics: mmap() errno=5 validating first page of '/Users/myUser/Library/Developer/Xcode/DerivedData/Networking-fvqcarmnxbbcoudwebdojwjthuyy/Build/Products/Debug-appletvsimulator/APMetrics.framework/APMetrics' /Users/myUser/Library/Developer/Xcode/DerivedData/Networking-fvqcarmnxbbcoudwebdojwjthuyy/Build/Products/Debug-appletvsimulator/APMetrics.framework/APMetrics: stat() failed with errno=5 /Users/myUser/Library/Developer/Xcode/DerivedData/Networking-fvqcarmnxbbcoudwebdojwjthuyy/Build/Products/Debug-appletvsimulator/APMetrics.framework/APMetrics: mmap() errno=5 validating first page of '/Users/myUser/Library/Developer/Xcode/DerivedData/Networking-fvqcarmnxbbcoudwebdojwjthuyy/Build/Products/Debug-appletvsimulator/APMetrics.framework/APMetrics' /Users/myUser/Library/Developer/Xcode/DerivedData/Networking-fvqcarmnxbbcoudwebdojwjthuyy/Build/Products/Debug-appletvsimulator/Networking-tvOSTests.xctest/Frameworks/APMetrics.framework/APMetrics: mmap() errno=5 validating first page of '/Users/myUser/Library/Developer/Xcode/DerivedData/Networking-fvqcarmnxbbcoudwebdojwjthuyy/Build/Products/Debug-appletvsimulator/Networking-tvOSTests.xctest/Frameworks/APMetrics.framework/APMetrics' /Users/myUser/Library/Developer/Xcode/DerivedData/Networking-fvqcarmnxbbcoudwebdojwjthuyy/Build/Products/Debug-appletvsimulator/Networking-tvOSTests.xctest/Frameworks/APMetrics.framework/APMetrics: mmap() errno=5 validating first page of '/Users/myUser/Library/Developer/Xcode/DerivedData/Networking-fvqcarmnxbbcoudwebdojwjthuyy/Build/Products/Debug-appletvsimulator/Networking-tvOSTests.xctest/Frameworks/APMetrics.framework/APMetrics')Program ended with exit code: 82Thanks,Ronak
Posted
by ronak2121.
Last updated
.
Post not yet marked as solved
2 Replies
679 Views
Hi everyone,We have a Use Case where we have to download multiple files to allow a user to consume their content offline, and we'd like to show overall download progress, using NSProgress.I'm trying to use iOS 11's support for ProgressReporting directly from a URLSessionDataTask.The problem I'm running into here is that NSProgress expects clients of its API to know the amount of total work each child represents upfront. This is before the URLSessionDataTask has had a chance to get a reply back from the network.To get around this, I'm using KVO to wait until each individual URLSessionDataTask's Progress has a totalUnitCount set; and only add it as a child at that point.I was wondering if there was any other techniques or ideas anyone that would be more elegant.ThanksRonak
Posted
by ronak2121.
Last updated
.
Post not yet marked as solved
1 Replies
607 Views
Hi all,I was wondering if Apple will support submitting apps that use Swift Static Libraries? Swift Static Libraries are supported in Xcode 9.x, but I haven't seen much documentation about it.Otherwise, we'll have to stick to Cocoa Touch Frameworks.Thanks,Ronak
Posted
by ronak2121.
Last updated
.
Post not yet marked as solved
2 Replies
6.4k Views
Hi all,I was wondering if Apple will support submitting apps that use Swift Static Libraries? Swift Static Libraries are supported in Xcode 9.x, but I haven't seen much documentation about it.Otherwise, we'll have to stick to Cocoa Touch Frameworks.Thanks,Ronak
Posted
by ronak2121.
Last updated
.
Post marked as solved
2 Replies
642 Views
Hi,We're trying to debug and correct a most bizarre issue with AVAudioEngine.We are using AVAudioEngine to play an MPEG4 wrapped AAC file and we're hearing stuttering when we play() after we have paused() the engine.Here's our implementation for both pause() and play(): func play() throws { // add any taps we want if !engine.isRunning { try engine.start() } audioPlayerNode.play() } / func pause() { // remove any taps we have audioPlayerNode.pause() engine.pause() }where engine is an AVAudioEngine instance, and audioPlayerNode is an AVAudioPlayerNode instance.Has anyone ever encountered this sort of behavior? How did you resolve this?
Posted
by ronak2121.
Last updated
.