Media Player

RSS for tag

Find and play songs, audio podcasts, audio books, and more from within your app using Media Player.

Posts under Media Player tag

200 Posts

Post

Replies

Boosts

Views

Activity

MPNowPlayingInfoCenter not fully available if player playback controls disabled
If I disable playback controls for an AVPlayer (showsPlaybackControls), some feature of MPNowPlayingInfoCenter no longer working. (play/pause, skip forward and backward). I need custom video and audio controls on my AVPlayer in my app, that's why I disabled the iOS playback controls. But I also need the features of the MPNowPlayingInfoCenter. Is there another solution to achieve this?
1
0
1k
Jul ’23
AVPlayer Play new Audio from background state
Hi Team, I am trying to play audio by using AVPlayer from the background that I have fetch data from api after first content play and start next content taken from api. Firstly I play audio from the foreground state than put my app in background after few minutes first audio completed and I try to initiate AVPlayer using next audio content from background but the audio is not playing. Same audio playing in next mode fine when app is in foreground state.
0
0
625
Jul ’23
Best first-party way to stream audio on iOS
Hi, I am currently using the third-party audio library to play audio in my app. It's worth noting that my app deals exclusively with network audio, so the audio that is stored on the network. I deal with Shoutcast streams and just remote MP3 files. Is there a way to do this with native APple APIs? My motivation is that I want to adopt Share Play, lock screen player support and other native goodies. I use Swift UI.P.S. Sorry for random tags, I am blind and the interface for choosing tags cannot be used with VoiceOver
0
0
993
Jul ’23
Breaking issue with ApplicationMusicPlayer: Library albums played out of order on 16.6 and iOS 17
As of the latest builds of both iOS 16.6 and iOS 17.0, playing albums from a users library using ApplicationMusicPlayer plays the songs on that album out of order. This is a dealbreaker for my app, and I’ve had to revert back to the Media Player framework for reliable behavior. If I fetch an album from a MusicLibraryRequest and load it into the queue using the API introduced in 16.4, init(album:startingAt:)., it starts at track 1 but then plays the rest of the tracks in random order. This happens whether skipping tracks or letting them play through. The shuffleMode of the player is .off. The issue does not occur with albums fetched from the Apple Music catalog and loaded using that same API, nor does it occur for MPMediaItemCollections loaded into an applicationQueuePlayer via a queue descriptor. I've submitted this issue as FB12495051 and provided a sysdiagnose. Please let me know if I can provide any other information.
2
0
933
Jul ’23
No audio on device speakers, works fine with headphones / airplay
hi I am having a issue with sound on a network video stream, the stream is loaded by a m3u,. during playback there is no audio from the device, however when using headphones / airplay audio works correctly. the other peculiar thing is the device simulator works fine. this maybe related to airplay working, but I don't know. this is the view handling the playback. Im not sure where the issue is. I can also play the videos fine when embedding the avplayer in its own view. but that looks messy when you have to dismiss a second window when closing the video. #if os(iOS) import SwiftUI import AVKit import MediaPlayer struct iOSVideoLibraryView: View { @ObservedObject var videoLibrary: VideoLibrary @State private var isPlayerDismissed = false let LiveStreams = [GridItem(.flexible()), GridItem(.flexible()), GridItem(.flexible())] let VODStreams = [GridItem(.flexible()), GridItem(.flexible()), GridItem(.flexible()), GridItem(.flexible())] var body: some View { NavigationView { ScrollView { LazyVGrid(columns: LiveStreams, spacing: 20) { ForEach(videoLibrary.videos, id: \.title) { video in if video.type == "LIVE" { Button(action: { isPlayerDismissed = false // Reset the dismissal flag presentVideoPlayer(videoURL: video.referenceURL) }) { VStack { Image(systemName: "play.circle.fill") .font(.system(size: 30)) // icon .foregroundColor(.blue) Text(video.title) .frame(width: 100, height: 50) // title bounds .font(Font.caption) .background(Color.blue) .foregroundColor(.white) .cornerRadius(3) } .frame(width: 70) // main button container .padding() .background(Color.blue.opacity(0.2)) .cornerRadius(10) } } else { // Handle non-LIVE videos } } } .padding() } .navigationBarTitle("Live Streams") } } private func presentVideoPlayer(videoURL: URL) { let playerViewController = CustomAVPlayerViewController() let player = AVPlayer(url: videoURL) playerViewController.player = player player.isMuted = false player.play() DispatchQueue.main.async { playerViewController.modalPresentationStyle = .fullScreen UIApplication.shared.windows.first?.rootViewController?.present(playerViewController, animated: true, completion: nil) } } } class PlayerManager: NSObject, AVPictureInPictureControllerDelegate { static let shared = PlayerManager() func pictureInPictureControllerWillStartPictureInPicture(_ pictureInPictureController: AVPictureInPictureController) { // Perform any necessary actions when picture-in-picture starts } func pictureInPictureControllerDidStopPictureInPicture(_ pictureInPictureController: AVPictureInPictureController) { // Perform any necessary actions when picture-in-picture stops } func pictureInPictureController(_ pictureInPictureController: AVPictureInPictureController, failedToStartPictureInPictureWithError error: Error) { // Perform any necessary actions when picture-in-picture fails to start } } class CustomAVPlayerViewController: AVPlayerViewController { let playerManager = PlayerManager.shared let customPlayer = AVPlayer() override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) if AVPictureInPictureController.isPictureInPictureSupported() { if let playerItem = customPlayer.currentItem { let playerLayer = AVPlayerLayer(player: customPlayer) playerLayer.videoGravity = .resizeAspectFill let pictureInPictureController = AVPictureInPictureController(playerLayer: playerLayer) pictureInPictureController?.delegate = playerManager if let pictureInPictureController = pictureInPictureController, pictureInPictureController.isPictureInPicturePossible { pictureInPictureController.startPictureInPicture() } } } } override func viewDidLoad() { super.viewDidLoad() customPlayer.addObserver(self, forKeyPath: "currentItem", options: .new, context: nil) } override func viewDidDisappear(_ animated: Bool) { super.viewDidDisappear(animated) customPlayer.removeObserver(self, forKeyPath: "currentItem") } override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) { if keyPath == "currentItem" { if let playerItem = customPlayer.currentItem { // Handle player item change } } } } #endif
2
0
1.3k
Jun ’23
ApplicationMusicPlayer on macOS Ventura?
Hey there Apple Music team! I'm excited to dig into the sessions coming up this week, and what I've seen so far from the developer documentation diffs looks great: audio quality, artist images, and a way to interface with a user's music library in MusicKit. Love it! The thing at the very top of my WWDC wishlist this year was macOS/Mac Catalyst support for the ApplicationMusicPlayer class. I just got finished installing Ventura and Xcode 14, and sadly it looks like the support story is the same as on Big Sur. No API availability on macOS, and an available Mac Catalyst API that ultimately results in the same error from a feedback I submitted on Big Sur: FB9851840 The connection to service named com.apple.Music.MPMusicPlayerApplicationControllerInternal was invalidated: failed at lookup with error 3 - No such process. Is that the end of the story on Ventura, or is there a chance support might be added in a later beta? Is there any additional detail at all that can be shared? I field several requests a week asking if/when my app is coming to the Mac, and I would really love to be able to make that happen. If there is anything at all I can do to test and help overcome the engineering challenges alluded to in the past, I am ready, willing, and able! In any case, thanks for the great work, and I'm looking forward to spending time with the new stuff this summer.
2
1
2.3k
Jun ’23
applicationQueuePlayer stopped working in installed app after device update to ios 16.4 and 16.4.1
I'm using applicationQueuePlayer in my application. I set Queue for it and it plays music. It was working fine in the app installed on my phone, but after phone was updated to iOS 16.4 it stopped working (see errors below). When I remove app from phone and recompiled and re-installed it to that phone, player started working normally. But when I replaced container via Xcodes Device and Simulators to previously saved - it stopped working again. Re-installing it on top of existing didn't fix it. It was only working if removed from phone completely and then installed from Xcode "from scratched". This started happening after phone update to 16.4. When I installed app "from scratch" - it was working fine, but when 16.4.1 was release couple of days ago and I installed it on a phone, it again broke the applicationQueuePlayer in my app. Same thing - removing app from phone and installing from scratch from Xcode makes it work, but restoring old container via Devices and Simulators breaks it again. I presume it has something to do with entitlements, but can't find any notes or info. Please help! Errors in log after attempting to start playing a title: 2023-04-12 14:56:19.400111-0400 MicyclePro[26736:2608042] [core] Attempted to register account monitor for types client is not authorized to access: {( "com.apple.account.iTunesStore" )} 2023-04-12 14:56:19.400284-0400 MicyclePro[26736:2608042] [Default] <ICMonitoredAccountStore: 0x2834ef390> Failed to register for account monitoring. err=Error Domain=com.apple.accounts Code=7 "(null)" 2023-04-12 14:56:20.407123-0400 MicyclePro[26736:2608714] [SDKPlayback] SYNC-WATCHDOG-1: Attempting to wake up the remote process 2023-04-12 14:56:20.619230-0400 MicyclePro[26736:2608439] [SDKPlayback] applicationController: xpc service connection interrupted 2023-04-12 14:56:20.619376-0400 MicyclePro[26736:2608042] [SDKPlayback] Failed to obtain synchronousRemoteObject: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service with pid 26768 created from an endpoint" UserInfo={NSDebugDescription=connection to service with pid 26768 created from an endpoint} 2023-04-12 14:56:20.619816-0400 MicyclePro[26736:2608512] [SDKPlayback] applicationMusicPlayer: connection invalidated 2023-04-12 14:56:20.620993-0400 MicyclePro[26736:2608042] [SDKPlayback] applicationQueuePlayer _establishConnectionIfNeeded timeout [ping did not pong] 2023-04-12 14:56:20.621094-0400 MicyclePro[26736:2608042] [SDKPlayback] Failed to obtain synchronousRemoteObject: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service created from an endpoint was invalidated: failed to check-in, peer may have been unloaded: mach_error=10000003." UserInfo={NSDebugDescription=The connection to service created from an endpoint was invalidated: failed to check-in, peer may have been unloaded: mach_error=10000003.} 2023-04-12 14:56:20.621376-0400 MicyclePro[26736:2608042] [SDKPlayback] applicationQueuePlayer _establishConnectionIfNeeded timeout [ping did not pong] 2023-04-12 14:56:20.621411-0400 MicyclePro[26736:2608042] [SDKPlayback] Failed to obtain synchronousRemoteObject: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service created from an endpoint was invalidated: failed to check-in, peer may have been unloaded: mach_error=10000003." UserInfo={NSDebugDescription=The connection to service created from an endpoint was invalidated: failed to check-in, peer may have been unloaded: mach_error=10000003.} 2023-04-12 14:56:20.628535-0400 MicyclePro[26736:2608042] [SystemGestureGate] <0x10761aa20> Gesture: System gesture gate timed out.
5
0
2.2k
Jun ’23
Can I use AVPlayerViewController with AVPlayerLooper?
I want to use AVPlayerViewController to display the video but it should be in auto-play mode. Previously I was using AVPlayer for that and listening to the .AVPlayerItemDidPlayToEndTime notification but I wonder if there is a better way? eg. using AVPlayerLooper for instance so I don't have to use that .AVPlayerItemDidPlayToEndTime anymore I wrote something like this but it is not working - I have a black screen with video controls - probably because AVPlayerViewController does not have any playable content... struct VideoPlayerQueuedView: UIViewControllerRepresentable { let videoUrl: URL func makeUIViewController(context: Context) -> AVPlayerViewController { let queuePlayer = AVQueuePlayer() let playerViewController = AVPlayerViewController() // Create an AVPlayerItem from the videoUrl let playerItem = AVPlayerItem(url: videoUrl) // Create an AVPlayerLooper with the queuePlayer and the playerItem as the template item let playerLooper = AVPlayerLooper(player: queuePlayer, templateItem: playerItem) // Set the player property of AVPlayerViewController playerViewController.player = queuePlayer return playerViewController } func updateUIViewController(_ uiViewController: AVPlayerViewController, context: Context) { // Update the video player if needed } }
0
0
985
Jun ’23
Visualize AVPlayer track while playing a streamed m3u8 file
I am simply trying to visualize m3u8 files from my Amazon S3 server while they are playing on my AVPlayer. The basic context of my AVPlayer is that I first create AVURLAsset and attach the cookies required to access it and then subsequently create the AVPlayerItem. I then setup the AVPlayer, play it, and then setup an observer so that I can handle some logic when the audio file is done playing. I just want to be able to get the power data of the streamed file in real time or close to real time. I looked into audioTapProcessor but it does not appear to work with streamed files. I then looked into AVAudioEngine but that also does not work well with streams. Is there any solution to this?
0
0
851
May ’23
AVAudioFile fails to read some files with wrong extension
Hello, Here is an issue I encountered recently. Does anybody have feedback on this? Issue encountered AVAudioFile throws when opening WAV files and MPEG-DASH files with .mp3 extension, works fine with many other tested combinations of formats and extension (for example, an AIFF file with .mp3 extension is read by AVAudioFile without error). The Music app, AVAudioFile and ExtAudioFile all fail on the same files. However, previewing an audio file in Finder (select the file and hit the space bar) works regardless of the file extension. Why do I consider this an issue? AVAudioFile seems to rely on extension sometimes but not always to guess the audio format of the file, which leads to unexpected errors. I would expect AVAudioFile to deal properly with wrong extensions for all supported audio formats. ⚠️ This behaviour can cause real trouble in iOS and macOS applications using audio files coming from the user, which often have unreliable extensions. I published some code to easily reproduce the issue: https://github.com/ThomasHezard/AVAudioFileFormatIssue Thank you everybody, have a great day 😎
0
2
957
May ’23
MPNowPlayingInfoPropertyPlaybackRate not working.
private func updateNowPlayingInfo() { var nowPlayingInfo = [String: Any]() nowPlayingInfo[MPMediaItemPropertyTitle] = songLabel.text nowPlayingInfo[MPMediaItemPropertyPlaybackDuration] = Int(Double(audioLengthSamples) / audioSampleRate) nowPlayingInfo[MPNowPlayingInfoPropertyElapsedPlaybackTime] = Int(Double(currentPosition) / audioSampleRate) print(isPlaying) print("updateNow") let playbackRate = isPlaying ? self.timeEffect.rate : 0.0 print(playbackRate) nowPlayingInfo[MPNowPlayingInfoPropertyPlaybackRate] = playbackRate MPNowPlayingInfoCenter.default().nowPlayingInfo = nowPlayingInfo } Whenever I press my play/pause button in the app, I expect control center and the lock screen to reflect this. However, control center symbols stays as pause regardless of what I do in the app. Am I missing anything? Running on device with iOS 16.4.1. private func configureRemoteCommandCenter() { let commandCenter = MPRemoteCommandCenter.shared() // Play command commandCenter.playCommand.isEnabled = true commandCenter.playCommand.addTarget { [weak self] event in // Handle the play command self?.playOrPauseFunction() return .success } // Pause command commandCenter.pauseCommand.isEnabled = true commandCenter.pauseCommand.addTarget { [weak self] event in // Handle the pause command self?.playOrPauseFunction() return .success } commandCenter.togglePlayPauseCommand.isEnabled = true commandCenter.togglePlayPauseCommand.addTarget { [weak self] event in self?.playOrPauseFunction() return .success } commandCenter.changePlaybackRateCommand.isEnabled = true commandCenter.changePlaybackPositionCommand.isEnabled = true commandCenter.changePlaybackPositionCommand.addTarget { [unowned self] event in guard let event = event as? MPChangePlaybackPositionCommandEvent else { return .commandFailed } currentPosition = AVAudioFramePosition(event.positionTime * audioSampleRate) scrubSeek(to: Double(currentPosition)) updateNowPlayingInfo() return .success } // Add handlers for other remote control events here... }
0
0
894
May ’23
What system APIs are available for alarms and "undismissable" notifications
I have an idea for an iOS App that involves creating alarms and "undismissable" notifications. Currently, iOS has multiple system features like silent/ring mode, focus mode, security protections, and other system features that would limit the functionality of an app with this purpose. Basically, think of a system Amber Alert or how the iOS Alarm app works. Regardless of these system settings, the user will be notified of the importance of the alarm immediately. What I'm trying to develop are really two separate things. First an alarm app without a snooze (or a set snooze limit) where you must prove that you're awake. Second, integrate a web API service for volunteer first responders that notify them to respond to an emergency via an iOS app. These are not features that would limit a user's privacy, their experience using iOS, and, quite frankly, be something that is so difficult to implement. If anyone can direct me to any system APIs that would be available to use for the start of this app or make me aware of any "blockers" that would absolutely prevent me from developing this in iOS, I would really appreciate it. My research has not been very in depth and there are differences in opinions on approaches and possibilities. If you are an engineer at Apple and this turns out to be impossible or impractical with current versions of iOS, it would be great to have the ability to be able to do something of this nature in the future.
1
0
924
May ’23
How to get MPNowPlayingInfoCenter to display the MPNowPlayingInfoPropertyPlaybackProgress value instead of seconds?
I'm trying to configure the "Now Playing" information for my app on iOS. Using MPNowPlayingInfoCenter/MPRemoteCommandCenter is pretty straightforward for this. The issue I'm having is that the audio I'm playing is generated "on the fly" and I do not know the exact duration in seconds. I am able to synthesize an NSProgress to display the progress of the playback but the units are not in seconds. So if I use the NSProgress units with MPNowPlayingInfoCenter the "Now Playing" shows the units in seconds but it appears to be jumpy (because again my progress units are not in seconds but an approximation of the percent completed). [playInfo setObject:@(self.progress.totalUnitCount) forKey:MPMediaItemPropertyPlaybackDuration]; [playInfo setObject:@(self.progress.completedUnitCount) forKey:MPNowPlayingInfoPropertyElapsedPlaybackTime]; I see there is a MPNowPlayingInfoPropertyPlaybackProgress which looks like it would be perfect. I tried setting that instead of MPMediaItemPropertyPlaybackDuration/MPNowPlayingInfoPropertyElapsedPlaybackTime but it appears to have no effect in the "Now Playing" UI. I also tried setting MPNowPlayingInfoPropertyIsLiveStream to YES but that just makes the "Now Playing" UI display "Live" instead of the progress value. Is there a way I can show a progress bar without the units being displayed in seconds? Thanks in advance.
0
0
937
May ’23
[MusicKit & MediaPlayer] can not find song use persistentID
I have a song playlist whose element is MPMediaItem, and I want to share this song playlist, so my original plan was to use persistentID as the identification of the song, but I found that persistentID does not seem to be able to cross devices, use MPMediaQuery persistentID to query the result is empty. So my question is? In this case, what should I do to share this playlist, so that other users can find the corresponding song to play after getting the playlist.
0
0
666
May ’23
iOS 16.4 & iOS 16.4.1 AVPlayer play local mp4 file Failed
iPhone 14 Pro use AVPlayer play local mp4 file cannot play,but the AVPlayer timeControlStatus is AVPlayerTimeControlStatusPlaying after I update my iPhone system to iOS 16.4 and iOS 16.4.1. Here is the iPhone log,we can found the FigfilePlayer is in playing status, so callback to AVPlayer is playing. Testing By testing Photo App, cannot play the video I recorded before. AVPlayer playing online Video works good. After reboot my iPhone 14 Pro, everything works well. Tips please check the FigFilePlayer's changelog in iOS 16.4. default 19:34:54.508400+0800 mediaserverd AQMEIO_HAL.cpp:2220 FetchAndLogFrameSize GetCurrentIOBufferFrameSize deviceID=163, frame size is 512 default 19:34:54.508424+0800 mediaserverd AQMEIO_HAL.cpp:1898 SetIOBufferFrameSize Setting kAudioDevicePropertyBufferFrameSize to 1024 default 19:34:54.508447+0800 mediaserverd HP_Device.cpp:1077 Client request to set buffer frame size to 1024 on VAD 163. default 19:34:54.508549+0800 mediaserverd AggregateDevice_CommonBase.cpp:2877 Setting buffer frame size of 1024 on aggregate device 1771. default 19:34:54.508599+0800 mediaserverd AggregateDevice_CommonBase.cpp:2886 Requested to set 1024, setting buffer frame size of 1024 on aggregate device 1771. default 19:34:54.508749+0800 mediaserverd <<<< FigFilePlayer >>>> itemfig_becameBothCurrentAndReadyForInspection: [0x60b9f5400] P/YA preferred device format NOT changed; preferred sample rate CHANGED; preferred channel count NOT changed => do NOT need to rebuild render pipelines default 19:34:54.508825+0800 mediaserverd <<<< FigFilePlayer >>>> playerfig_updatePlayerActiveState: returning err = 0 default 19:34:54.508850+0800 mediaserverd <<<< FigFilePlayer >>>> playerfig_getNextPlaybackState: [0x60b9f5400] P/YA called. reason ClientInitiated, options: DiscourageWaiting error 19:34:54.508900+0800 ZebraPedia nw_resolver_start_query_timer_block_invoke [C11.1] Query fired: did not receive all answers in time for Hostname#5a04b3da:443 default 19:34:54.508932+0800 mediaserverd <<<< CENTRAL >>>> playercentral_performStartupTaskConfirmingRouteChoiceWithRoutingSessionManager: [0x60a973ef0] P/YA player is not eligible for RouteSessionManager, with reasons: routingSession manager = 0x0, allowsAirPlayVideo = true, willMixWithEveryone = false default 19:34:54.509083+0800 mDNSResponder [R26974] getaddrinfo stop -- hostname: <mask.hash: 'heJTH20uNYxyo7w3hHqb8A=='>, client pid: 7051 (ZebraPedia) default 19:34:54.509126+0800 mDNSResponder [Q18582] Keeping orphaned querier for up to 5 seconds default 19:34:54.509196+0800 mediaserverd <<<< CENTRAL >>>> playercentral_performStartupTaskConfirmingRouteChoiceWithRoutingSessionManager: [0x60a973ef0] P/YA Auto-routing timing breakdown. 0 ms for getting player state + 0 ms for getting session state + 0 ms for making routing decision = 0 ms Total default 19:34:54.509224+0800 SpringBoard Reevaluating promoted elements default 19:34:54.509254+0800 SpringBoard Update preferred layout mode assertion with layout mode preference: <SAUILayoutModePreference: 0x281385560; _preferredLayoutMode: removed; _layoutModeChangeReason: client> default 19:34:54.509282+0800 mediaserverd <<<< FigFilePlayer >>>> playerfig_performStartupTasksForEvents: (0x60b9f5400) P/YA Handled and completed startup task 0x606b14b80 [Auto Routing] default 19:34:54.509309+0800 mediaserverd <<<< FigFilePlayer >>>> playerfig_getNextPlaybackState: [0x60b9f5400] P/YA new playback state: Playing (playerRate: 1.000), NEED TO update item rate (1.000). Previous state: Paused, change reason: ClientInitiated default 19:34:54.509334+0800 mediaserverd <<<< FigFilePlayer >>>> playerfig_setBossRateWithFade: [0x60b9f5400] P/YA called, rate = 1.000, fadeDuration = nan, 176931.91441 default 19:34:54.509361+0800 mediaserverd <<<< FigFilePlayer >>>> playerfig_applySoftwareVolume: [0x60b9f5400] P/YA rp: [FigRenderPipeline 0x60ab95200], propertyName = SoftwareVolume1, targetVolume = 0.00, rampDuration = 0.00, synchronous = YES default 19:34:54.509413+0800 SpringBoard Elements ordered by promotion: ( ) default 19:34:54.509439+0800 ZebraPedia <<<< AVPlayer >>>> avplayer_fpNotificationCallback_block_invoke_13: P/YA setting timeControlStatus=2, reasonForWaitingToPlay=(null) default 19:34:54.509557+0800 mediaserverd <<<< FigFilePlayer >>>> playerfig_applySoftwareVolume: [0x60b9f5400] P/YA rp: [FigRenderPipeline 0x60ab95200], propertyName = SoftwareVolume5, targetVolume = 1.00, rampDuration = 0.00, synchronous = YES default 19:34:54.509634+0800 mediaserverd IOMobileFramebufferCreateDisplayList: All Display Instances enumerated successfully - FB Count = 1 default 19:34:54.510164+0800 mediaserverd <<<< Alt >>>> FPSupport_GetDisplayRefreshInformation: refreshRates:<private> default 19:34:54.510189+0800 SpringBoard quietMode is unchanged, still disabled default 19:34:54.510219+0800 mediaserverd <<<< Alt >>>> FPSupport_GetDisplayRefreshInformation: displayMaxRefreshInterval:1/10 displayMinRefreshInterval:1/120 displayRefreshStep:1/240 default 19:34:54.510251+0800 mediaserverd <<<< Boss >>>> FigPlaybackBossSetRateAndAnchorTime: (0x60ab9f2f0) called, newRate = 1.000, itemTime = nan, hostClockTime = (now+) nan default 19:34:54.510284+0800 mediaserverd <<<< Boss >>>> bossScheduleReachedEndCallbackForTime: (0x60ab9f2f0) called, endTime = nan default 19:34:54.510318+0800 mediaserverd <<<< Boss >>>> bossScheduleAdvanceForOverlappedPlaybackCallbackForTime: (0x60ab9f2f0) called, advanceTime = nan default 19:34:54.510351+0800 mediaserverd <<<< Boss >>>> bossConfigureRatePlan: requested rate 1.000 => will use audio time compression rate 1.000, timebase rate 1.000, NON-snippetised playback default 19:34:54.510382+0800 mediaserverd <<<< Boss >>>> figPlaybackBossSetRateToNonZero: (0x60ab9f2f0) last preroll is not compatible: no previous preroll default 19:34:54.510413+0800 mediaserverd <<<< Boss >>>> figPlaybackBossStartPrerollAndSetPlayState: (0x60ab9f2f0) called, prerollRate == 1.000, itemTime = nan, hostClockTime = nan, prerollTime = nan, useSnippetPlayback = NO, currentTimebaseTime == 0.000, newPlayState = PrerollingWillPlay default 19:34:54.510446+0800 mediaserverd <<<< Boss >>>> bossSetMentorModesToForwardPlayback: (0x60ab9f2f0) called, tracks 0...1, start time 0.000, end time nan, rate 1.00, previousOutputDisposition=3 default 19:34:54.510473+0800 mediaserverd <<<< Boss >>>> figPlaybackBossSetRateToNonZero: (0x60ab9f2f0) playState set to PrerollingWillPlay default 19:34:54.510505+0800 mediaserverd <<<< FAQ >>>> faq_reset: [0x606addc40:0x606a3c4d0] calling FigAudioQueueTimingShimReset default 19:34:54.510529+0800 mediaserverd <<<< FAQ TIMING SHIM >>>> FigAudioQueueTimingShimReset: [0x606c3f650] Calling AudioQueueReset(0x132dccd) default 19:34:54.510991+0800 mediaserverd AQMEIO_HAL.cpp:1185 User-selected BT device category is 0
1
0
1.1k
Apr ’23
NowPlaying State Not Updating on Apple Watch
My app plays music via AVAudioEngine. I'm using effects that prohibit me from using a built-in audio player. I'm using MPNowPlayingInfoCenter to provide information to the NowPlaying app on the Apple Watch. When I play a song, the Apple Watch displays the song metadata. When I hit pause on my phone, the Apple Watch shows that the track is no longer advancing via the progress wheel; however, it continues to display the pause button even though the music is paused. Ideally, it would switch to the play symbol when the music is paused. In the documentation it says you can use the playBackState var to set the playback state in macOS. There does not seem to be an equivalent in iOS. I figured maybe the watch would know to switch the pause symbol to the play symbol when the playback rate is 0, but it does not. All other functionality is working properly. The only thing that doesn't update on the watch is the pause / play symbol when the music toggles between play and pause by tapping my phone or from receiving remote command events. Thank you in advance for your help.
0
0
965
Apr ’23
Command Center media buttons is not syncing with App's media state Swift
I have created a media player plugin and exported it via swift framework for my Unity project, the media player works fine on the app. But, when the App's media state is paused the Command Center media button does not update its still on the pause icon and same as with playing the command center button does not update. I already have initiated the AVAudioSession shared instance and set the category to .playback and have also set the .setActive to true. let audioSession = AVAudioSession .sharedInstance() try audioSession .setCategory( .playback, mode: .default ) print("Playback OK") try audioSession.setActive(true) print("Session is Active") I also have initialised the command center, for handling the play and pause events whenever the buttons are clicked in command center. self.commandCenter.playCommand.isEnabled = true self.commandCenter.playCommand.addTarget { [weak self] (event) -> MPRemoteCommandHandlerStatus in self?.play() return .success } self.commandCenter.pauseCommand.isEnabled = true self.commandCenter.pauseCommand.addTarget { [weak self] (event) -> MPRemoteCommandHandlerStatus in self?.pause() return .success } This is the code for the handling the pause self.nowPlayingInfo[MPNowPlayingInfoPropertyElapsedPlaybackTime] = CMTimeGetSeconds(self.player.currentTime()) self.nowPlayingInfo[MPMediaItemPropertyPlaybackDuration] = CMTimeGetSeconds(self.player.currentItem!.duration); self.nowPlayingInfo[MPNowPlayingInfoPropertyPlaybackRate] = 0 self.nowPlayingInfo[MPNowPlayingInfoPropertyDefaultPlaybackRate] = 0 MPNowPlayingInfoCenter.default().nowPlayingInfo = self.nowPlayingInfo self.player.pause() and This is the code for handling the play self.nowPlayingInfo[MPNowPlayingInfoPropertyElapsedPlaybackTime] = CMTimeGetSeconds(self.player.currentTime()) self.nowPlayingInfo[MPMediaItemPropertyPlaybackDuration] = CMTimeGetSeconds(self.player.currentItem!.duration); self.nowPlayingInfo[MPNowPlayingInfoPropertyPlaybackRate] = 1 self.nowPlayingInfo[MPNowPlayingInfoPropertyDefaultPlaybackRate] = 1 MPNowPlayingInfoCenter.default().nowPlayingInfo = self.nowPlayingInfo; self.player.play() What i am expecting is when i click on pause in the App the command center's button should be the play icon if I click on play the command center's button should be pause icon, but right now nothing is working. Please tell me what I am missing here?
1
0
1.1k
Apr ’23
MPNowPlayingInfoCenter not fully available if player playback controls disabled
If I disable playback controls for an AVPlayer (showsPlaybackControls), some feature of MPNowPlayingInfoCenter no longer working. (play/pause, skip forward and backward). I need custom video and audio controls on my AVPlayer in my app, that's why I disabled the iOS playback controls. But I also need the features of the MPNowPlayingInfoCenter. Is there another solution to achieve this?
Replies
1
Boosts
0
Views
1k
Activity
Jul ’23
AVPlayer Play new Audio from background state
Hi Team, I am trying to play audio by using AVPlayer from the background that I have fetch data from api after first content play and start next content taken from api. Firstly I play audio from the foreground state than put my app in background after few minutes first audio completed and I try to initiate AVPlayer using next audio content from background but the audio is not playing. Same audio playing in next mode fine when app is in foreground state.
Replies
0
Boosts
0
Views
625
Activity
Jul ’23
Best first-party way to stream audio on iOS
Hi, I am currently using the third-party audio library to play audio in my app. It's worth noting that my app deals exclusively with network audio, so the audio that is stored on the network. I deal with Shoutcast streams and just remote MP3 files. Is there a way to do this with native APple APIs? My motivation is that I want to adopt Share Play, lock screen player support and other native goodies. I use Swift UI.P.S. Sorry for random tags, I am blind and the interface for choosing tags cannot be used with VoiceOver
Replies
0
Boosts
0
Views
993
Activity
Jul ’23
Breaking issue with ApplicationMusicPlayer: Library albums played out of order on 16.6 and iOS 17
As of the latest builds of both iOS 16.6 and iOS 17.0, playing albums from a users library using ApplicationMusicPlayer plays the songs on that album out of order. This is a dealbreaker for my app, and I’ve had to revert back to the Media Player framework for reliable behavior. If I fetch an album from a MusicLibraryRequest and load it into the queue using the API introduced in 16.4, init(album:startingAt:)., it starts at track 1 but then plays the rest of the tracks in random order. This happens whether skipping tracks or letting them play through. The shuffleMode of the player is .off. The issue does not occur with albums fetched from the Apple Music catalog and loaded using that same API, nor does it occur for MPMediaItemCollections loaded into an applicationQueuePlayer via a queue descriptor. I've submitted this issue as FB12495051 and provided a sysdiagnose. Please let me know if I can provide any other information.
Replies
2
Boosts
0
Views
933
Activity
Jul ’23
No audio on device speakers, works fine with headphones / airplay
hi I am having a issue with sound on a network video stream, the stream is loaded by a m3u,. during playback there is no audio from the device, however when using headphones / airplay audio works correctly. the other peculiar thing is the device simulator works fine. this maybe related to airplay working, but I don't know. this is the view handling the playback. Im not sure where the issue is. I can also play the videos fine when embedding the avplayer in its own view. but that looks messy when you have to dismiss a second window when closing the video. #if os(iOS) import SwiftUI import AVKit import MediaPlayer struct iOSVideoLibraryView: View { @ObservedObject var videoLibrary: VideoLibrary @State private var isPlayerDismissed = false let LiveStreams = [GridItem(.flexible()), GridItem(.flexible()), GridItem(.flexible())] let VODStreams = [GridItem(.flexible()), GridItem(.flexible()), GridItem(.flexible()), GridItem(.flexible())] var body: some View { NavigationView { ScrollView { LazyVGrid(columns: LiveStreams, spacing: 20) { ForEach(videoLibrary.videos, id: \.title) { video in if video.type == "LIVE" { Button(action: { isPlayerDismissed = false // Reset the dismissal flag presentVideoPlayer(videoURL: video.referenceURL) }) { VStack { Image(systemName: "play.circle.fill") .font(.system(size: 30)) // icon .foregroundColor(.blue) Text(video.title) .frame(width: 100, height: 50) // title bounds .font(Font.caption) .background(Color.blue) .foregroundColor(.white) .cornerRadius(3) } .frame(width: 70) // main button container .padding() .background(Color.blue.opacity(0.2)) .cornerRadius(10) } } else { // Handle non-LIVE videos } } } .padding() } .navigationBarTitle("Live Streams") } } private func presentVideoPlayer(videoURL: URL) { let playerViewController = CustomAVPlayerViewController() let player = AVPlayer(url: videoURL) playerViewController.player = player player.isMuted = false player.play() DispatchQueue.main.async { playerViewController.modalPresentationStyle = .fullScreen UIApplication.shared.windows.first?.rootViewController?.present(playerViewController, animated: true, completion: nil) } } } class PlayerManager: NSObject, AVPictureInPictureControllerDelegate { static let shared = PlayerManager() func pictureInPictureControllerWillStartPictureInPicture(_ pictureInPictureController: AVPictureInPictureController) { // Perform any necessary actions when picture-in-picture starts } func pictureInPictureControllerDidStopPictureInPicture(_ pictureInPictureController: AVPictureInPictureController) { // Perform any necessary actions when picture-in-picture stops } func pictureInPictureController(_ pictureInPictureController: AVPictureInPictureController, failedToStartPictureInPictureWithError error: Error) { // Perform any necessary actions when picture-in-picture fails to start } } class CustomAVPlayerViewController: AVPlayerViewController { let playerManager = PlayerManager.shared let customPlayer = AVPlayer() override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) if AVPictureInPictureController.isPictureInPictureSupported() { if let playerItem = customPlayer.currentItem { let playerLayer = AVPlayerLayer(player: customPlayer) playerLayer.videoGravity = .resizeAspectFill let pictureInPictureController = AVPictureInPictureController(playerLayer: playerLayer) pictureInPictureController?.delegate = playerManager if let pictureInPictureController = pictureInPictureController, pictureInPictureController.isPictureInPicturePossible { pictureInPictureController.startPictureInPicture() } } } } override func viewDidLoad() { super.viewDidLoad() customPlayer.addObserver(self, forKeyPath: "currentItem", options: .new, context: nil) } override func viewDidDisappear(_ animated: Bool) { super.viewDidDisappear(animated) customPlayer.removeObserver(self, forKeyPath: "currentItem") } override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) { if keyPath == "currentItem" { if let playerItem = customPlayer.currentItem { // Handle player item change } } } } #endif
Replies
2
Boosts
0
Views
1.3k
Activity
Jun ’23
ApplicationMusicPlayer on macOS Ventura?
Hey there Apple Music team! I'm excited to dig into the sessions coming up this week, and what I've seen so far from the developer documentation diffs looks great: audio quality, artist images, and a way to interface with a user's music library in MusicKit. Love it! The thing at the very top of my WWDC wishlist this year was macOS/Mac Catalyst support for the ApplicationMusicPlayer class. I just got finished installing Ventura and Xcode 14, and sadly it looks like the support story is the same as on Big Sur. No API availability on macOS, and an available Mac Catalyst API that ultimately results in the same error from a feedback I submitted on Big Sur: FB9851840 The connection to service named com.apple.Music.MPMusicPlayerApplicationControllerInternal was invalidated: failed at lookup with error 3 - No such process. Is that the end of the story on Ventura, or is there a chance support might be added in a later beta? Is there any additional detail at all that can be shared? I field several requests a week asking if/when my app is coming to the Mac, and I would really love to be able to make that happen. If there is anything at all I can do to test and help overcome the engineering challenges alluded to in the past, I am ready, willing, and able! In any case, thanks for the great work, and I'm looking forward to spending time with the new stuff this summer.
Replies
2
Boosts
1
Views
2.3k
Activity
Jun ’23
applicationQueuePlayer stopped working in installed app after device update to ios 16.4 and 16.4.1
I'm using applicationQueuePlayer in my application. I set Queue for it and it plays music. It was working fine in the app installed on my phone, but after phone was updated to iOS 16.4 it stopped working (see errors below). When I remove app from phone and recompiled and re-installed it to that phone, player started working normally. But when I replaced container via Xcodes Device and Simulators to previously saved - it stopped working again. Re-installing it on top of existing didn't fix it. It was only working if removed from phone completely and then installed from Xcode "from scratched". This started happening after phone update to 16.4. When I installed app "from scratch" - it was working fine, but when 16.4.1 was release couple of days ago and I installed it on a phone, it again broke the applicationQueuePlayer in my app. Same thing - removing app from phone and installing from scratch from Xcode makes it work, but restoring old container via Devices and Simulators breaks it again. I presume it has something to do with entitlements, but can't find any notes or info. Please help! Errors in log after attempting to start playing a title: 2023-04-12 14:56:19.400111-0400 MicyclePro[26736:2608042] [core] Attempted to register account monitor for types client is not authorized to access: {( "com.apple.account.iTunesStore" )} 2023-04-12 14:56:19.400284-0400 MicyclePro[26736:2608042] [Default] <ICMonitoredAccountStore: 0x2834ef390> Failed to register for account monitoring. err=Error Domain=com.apple.accounts Code=7 "(null)" 2023-04-12 14:56:20.407123-0400 MicyclePro[26736:2608714] [SDKPlayback] SYNC-WATCHDOG-1: Attempting to wake up the remote process 2023-04-12 14:56:20.619230-0400 MicyclePro[26736:2608439] [SDKPlayback] applicationController: xpc service connection interrupted 2023-04-12 14:56:20.619376-0400 MicyclePro[26736:2608042] [SDKPlayback] Failed to obtain synchronousRemoteObject: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service with pid 26768 created from an endpoint" UserInfo={NSDebugDescription=connection to service with pid 26768 created from an endpoint} 2023-04-12 14:56:20.619816-0400 MicyclePro[26736:2608512] [SDKPlayback] applicationMusicPlayer: connection invalidated 2023-04-12 14:56:20.620993-0400 MicyclePro[26736:2608042] [SDKPlayback] applicationQueuePlayer _establishConnectionIfNeeded timeout [ping did not pong] 2023-04-12 14:56:20.621094-0400 MicyclePro[26736:2608042] [SDKPlayback] Failed to obtain synchronousRemoteObject: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service created from an endpoint was invalidated: failed to check-in, peer may have been unloaded: mach_error=10000003." UserInfo={NSDebugDescription=The connection to service created from an endpoint was invalidated: failed to check-in, peer may have been unloaded: mach_error=10000003.} 2023-04-12 14:56:20.621376-0400 MicyclePro[26736:2608042] [SDKPlayback] applicationQueuePlayer _establishConnectionIfNeeded timeout [ping did not pong] 2023-04-12 14:56:20.621411-0400 MicyclePro[26736:2608042] [SDKPlayback] Failed to obtain synchronousRemoteObject: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service created from an endpoint was invalidated: failed to check-in, peer may have been unloaded: mach_error=10000003." UserInfo={NSDebugDescription=The connection to service created from an endpoint was invalidated: failed to check-in, peer may have been unloaded: mach_error=10000003.} 2023-04-12 14:56:20.628535-0400 MicyclePro[26736:2608042] [SystemGestureGate] <0x10761aa20> Gesture: System gesture gate timed out.
Replies
5
Boosts
0
Views
2.2k
Activity
Jun ’23
Can I use AVPlayerViewController with AVPlayerLooper?
I want to use AVPlayerViewController to display the video but it should be in auto-play mode. Previously I was using AVPlayer for that and listening to the .AVPlayerItemDidPlayToEndTime notification but I wonder if there is a better way? eg. using AVPlayerLooper for instance so I don't have to use that .AVPlayerItemDidPlayToEndTime anymore I wrote something like this but it is not working - I have a black screen with video controls - probably because AVPlayerViewController does not have any playable content... struct VideoPlayerQueuedView: UIViewControllerRepresentable { let videoUrl: URL func makeUIViewController(context: Context) -> AVPlayerViewController { let queuePlayer = AVQueuePlayer() let playerViewController = AVPlayerViewController() // Create an AVPlayerItem from the videoUrl let playerItem = AVPlayerItem(url: videoUrl) // Create an AVPlayerLooper with the queuePlayer and the playerItem as the template item let playerLooper = AVPlayerLooper(player: queuePlayer, templateItem: playerItem) // Set the player property of AVPlayerViewController playerViewController.player = queuePlayer return playerViewController } func updateUIViewController(_ uiViewController: AVPlayerViewController, context: Context) { // Update the video player if needed } }
Replies
0
Boosts
0
Views
985
Activity
Jun ’23
Visualize AVPlayer track while playing a streamed m3u8 file
I am simply trying to visualize m3u8 files from my Amazon S3 server while they are playing on my AVPlayer. The basic context of my AVPlayer is that I first create AVURLAsset and attach the cookies required to access it and then subsequently create the AVPlayerItem. I then setup the AVPlayer, play it, and then setup an observer so that I can handle some logic when the audio file is done playing. I just want to be able to get the power data of the streamed file in real time or close to real time. I looked into audioTapProcessor but it does not appear to work with streamed files. I then looked into AVAudioEngine but that also does not work well with streams. Is there any solution to this?
Replies
0
Boosts
0
Views
851
Activity
May ’23
AVAudioFile fails to read some files with wrong extension
Hello, Here is an issue I encountered recently. Does anybody have feedback on this? Issue encountered AVAudioFile throws when opening WAV files and MPEG-DASH files with .mp3 extension, works fine with many other tested combinations of formats and extension (for example, an AIFF file with .mp3 extension is read by AVAudioFile without error). The Music app, AVAudioFile and ExtAudioFile all fail on the same files. However, previewing an audio file in Finder (select the file and hit the space bar) works regardless of the file extension. Why do I consider this an issue? AVAudioFile seems to rely on extension sometimes but not always to guess the audio format of the file, which leads to unexpected errors. I would expect AVAudioFile to deal properly with wrong extensions for all supported audio formats. ⚠️ This behaviour can cause real trouble in iOS and macOS applications using audio files coming from the user, which often have unreliable extensions. I published some code to easily reproduce the issue: https://github.com/ThomasHezard/AVAudioFileFormatIssue Thank you everybody, have a great day 😎
Replies
0
Boosts
2
Views
957
Activity
May ’23
MPNowPlayingInfoPropertyPlaybackRate not working.
private func updateNowPlayingInfo() { var nowPlayingInfo = [String: Any]() nowPlayingInfo[MPMediaItemPropertyTitle] = songLabel.text nowPlayingInfo[MPMediaItemPropertyPlaybackDuration] = Int(Double(audioLengthSamples) / audioSampleRate) nowPlayingInfo[MPNowPlayingInfoPropertyElapsedPlaybackTime] = Int(Double(currentPosition) / audioSampleRate) print(isPlaying) print("updateNow") let playbackRate = isPlaying ? self.timeEffect.rate : 0.0 print(playbackRate) nowPlayingInfo[MPNowPlayingInfoPropertyPlaybackRate] = playbackRate MPNowPlayingInfoCenter.default().nowPlayingInfo = nowPlayingInfo } Whenever I press my play/pause button in the app, I expect control center and the lock screen to reflect this. However, control center symbols stays as pause regardless of what I do in the app. Am I missing anything? Running on device with iOS 16.4.1. private func configureRemoteCommandCenter() { let commandCenter = MPRemoteCommandCenter.shared() // Play command commandCenter.playCommand.isEnabled = true commandCenter.playCommand.addTarget { [weak self] event in // Handle the play command self?.playOrPauseFunction() return .success } // Pause command commandCenter.pauseCommand.isEnabled = true commandCenter.pauseCommand.addTarget { [weak self] event in // Handle the pause command self?.playOrPauseFunction() return .success } commandCenter.togglePlayPauseCommand.isEnabled = true commandCenter.togglePlayPauseCommand.addTarget { [weak self] event in self?.playOrPauseFunction() return .success } commandCenter.changePlaybackRateCommand.isEnabled = true commandCenter.changePlaybackPositionCommand.isEnabled = true commandCenter.changePlaybackPositionCommand.addTarget { [unowned self] event in guard let event = event as? MPChangePlaybackPositionCommandEvent else { return .commandFailed } currentPosition = AVAudioFramePosition(event.positionTime * audioSampleRate) scrubSeek(to: Double(currentPosition)) updateNowPlayingInfo() return .success } // Add handlers for other remote control events here... }
Replies
0
Boosts
0
Views
894
Activity
May ’23
Unknown error occurred (-12842)
Using quicktime play mp4 file, an error occurred and the document "XX. mp4" could not be opened. An unknown error occurred (-12842), and with Safari browser, only the first keyframe can be played and the video will become stuck. Both Chrome and Firefox can play [normally]
Replies
1
Boosts
0
Views
1.3k
Activity
May ’23
What system APIs are available for alarms and "undismissable" notifications
I have an idea for an iOS App that involves creating alarms and "undismissable" notifications. Currently, iOS has multiple system features like silent/ring mode, focus mode, security protections, and other system features that would limit the functionality of an app with this purpose. Basically, think of a system Amber Alert or how the iOS Alarm app works. Regardless of these system settings, the user will be notified of the importance of the alarm immediately. What I'm trying to develop are really two separate things. First an alarm app without a snooze (or a set snooze limit) where you must prove that you're awake. Second, integrate a web API service for volunteer first responders that notify them to respond to an emergency via an iOS app. These are not features that would limit a user's privacy, their experience using iOS, and, quite frankly, be something that is so difficult to implement. If anyone can direct me to any system APIs that would be available to use for the start of this app or make me aware of any "blockers" that would absolutely prevent me from developing this in iOS, I would really appreciate it. My research has not been very in depth and there are differences in opinions on approaches and possibilities. If you are an engineer at Apple and this turns out to be impossible or impractical with current versions of iOS, it would be great to have the ability to be able to do something of this nature in the future.
Replies
1
Boosts
0
Views
924
Activity
May ’23
How to get MPNowPlayingInfoCenter to display the MPNowPlayingInfoPropertyPlaybackProgress value instead of seconds?
I'm trying to configure the "Now Playing" information for my app on iOS. Using MPNowPlayingInfoCenter/MPRemoteCommandCenter is pretty straightforward for this. The issue I'm having is that the audio I'm playing is generated "on the fly" and I do not know the exact duration in seconds. I am able to synthesize an NSProgress to display the progress of the playback but the units are not in seconds. So if I use the NSProgress units with MPNowPlayingInfoCenter the "Now Playing" shows the units in seconds but it appears to be jumpy (because again my progress units are not in seconds but an approximation of the percent completed). [playInfo setObject:@(self.progress.totalUnitCount) forKey:MPMediaItemPropertyPlaybackDuration]; [playInfo setObject:@(self.progress.completedUnitCount) forKey:MPNowPlayingInfoPropertyElapsedPlaybackTime]; I see there is a MPNowPlayingInfoPropertyPlaybackProgress which looks like it would be perfect. I tried setting that instead of MPMediaItemPropertyPlaybackDuration/MPNowPlayingInfoPropertyElapsedPlaybackTime but it appears to have no effect in the "Now Playing" UI. I also tried setting MPNowPlayingInfoPropertyIsLiveStream to YES but that just makes the "Now Playing" UI display "Live" instead of the progress value. Is there a way I can show a progress bar without the units being displayed in seconds? Thanks in advance.
Replies
0
Boosts
0
Views
937
Activity
May ’23
[MusicKit & MediaPlayer] can not find song use persistentID
I have a song playlist whose element is MPMediaItem, and I want to share this song playlist, so my original plan was to use persistentID as the identification of the song, but I found that persistentID does not seem to be able to cross devices, use MPMediaQuery persistentID to query the result is empty. So my question is? In this case, what should I do to share this playlist, so that other users can find the corresponding song to play after getting the playlist.
Replies
0
Boosts
0
Views
666
Activity
May ’23
SwiftUI VideoPlayer (Video Controls) in iOS14
Is there a way to disable the default video controls (play/pause/scrubber/etc) on the new SwiftUI VideoPlayer in iOS14, so I could create a custom one?
Replies
6
Boosts
1
Views
12k
Activity
May ’23
Native app Podcast
Good day. There is a default podcast app on the phone. If you listen to a recording in it and receive a notification at the same time, the podcast sound volume is not descend. Can you please tell me if this is intentional behavior or a bug in the app?
Replies
0
Boosts
0
Views
470
Activity
Apr ’23
iOS 16.4 & iOS 16.4.1 AVPlayer play local mp4 file Failed
iPhone 14 Pro use AVPlayer play local mp4 file cannot play,but the AVPlayer timeControlStatus is AVPlayerTimeControlStatusPlaying after I update my iPhone system to iOS 16.4 and iOS 16.4.1. Here is the iPhone log,we can found the FigfilePlayer is in playing status, so callback to AVPlayer is playing. Testing By testing Photo App, cannot play the video I recorded before. AVPlayer playing online Video works good. After reboot my iPhone 14 Pro, everything works well. Tips please check the FigFilePlayer's changelog in iOS 16.4. default 19:34:54.508400+0800 mediaserverd AQMEIO_HAL.cpp:2220 FetchAndLogFrameSize GetCurrentIOBufferFrameSize deviceID=163, frame size is 512 default 19:34:54.508424+0800 mediaserverd AQMEIO_HAL.cpp:1898 SetIOBufferFrameSize Setting kAudioDevicePropertyBufferFrameSize to 1024 default 19:34:54.508447+0800 mediaserverd HP_Device.cpp:1077 Client request to set buffer frame size to 1024 on VAD 163. default 19:34:54.508549+0800 mediaserverd AggregateDevice_CommonBase.cpp:2877 Setting buffer frame size of 1024 on aggregate device 1771. default 19:34:54.508599+0800 mediaserverd AggregateDevice_CommonBase.cpp:2886 Requested to set 1024, setting buffer frame size of 1024 on aggregate device 1771. default 19:34:54.508749+0800 mediaserverd <<<< FigFilePlayer >>>> itemfig_becameBothCurrentAndReadyForInspection: [0x60b9f5400] P/YA preferred device format NOT changed; preferred sample rate CHANGED; preferred channel count NOT changed => do NOT need to rebuild render pipelines default 19:34:54.508825+0800 mediaserverd <<<< FigFilePlayer >>>> playerfig_updatePlayerActiveState: returning err = 0 default 19:34:54.508850+0800 mediaserverd <<<< FigFilePlayer >>>> playerfig_getNextPlaybackState: [0x60b9f5400] P/YA called. reason ClientInitiated, options: DiscourageWaiting error 19:34:54.508900+0800 ZebraPedia nw_resolver_start_query_timer_block_invoke [C11.1] Query fired: did not receive all answers in time for Hostname#5a04b3da:443 default 19:34:54.508932+0800 mediaserverd <<<< CENTRAL >>>> playercentral_performStartupTaskConfirmingRouteChoiceWithRoutingSessionManager: [0x60a973ef0] P/YA player is not eligible for RouteSessionManager, with reasons: routingSession manager = 0x0, allowsAirPlayVideo = true, willMixWithEveryone = false default 19:34:54.509083+0800 mDNSResponder [R26974] getaddrinfo stop -- hostname: <mask.hash: 'heJTH20uNYxyo7w3hHqb8A=='>, client pid: 7051 (ZebraPedia) default 19:34:54.509126+0800 mDNSResponder [Q18582] Keeping orphaned querier for up to 5 seconds default 19:34:54.509196+0800 mediaserverd <<<< CENTRAL >>>> playercentral_performStartupTaskConfirmingRouteChoiceWithRoutingSessionManager: [0x60a973ef0] P/YA Auto-routing timing breakdown. 0 ms for getting player state + 0 ms for getting session state + 0 ms for making routing decision = 0 ms Total default 19:34:54.509224+0800 SpringBoard Reevaluating promoted elements default 19:34:54.509254+0800 SpringBoard Update preferred layout mode assertion with layout mode preference: <SAUILayoutModePreference: 0x281385560; _preferredLayoutMode: removed; _layoutModeChangeReason: client> default 19:34:54.509282+0800 mediaserverd <<<< FigFilePlayer >>>> playerfig_performStartupTasksForEvents: (0x60b9f5400) P/YA Handled and completed startup task 0x606b14b80 [Auto Routing] default 19:34:54.509309+0800 mediaserverd <<<< FigFilePlayer >>>> playerfig_getNextPlaybackState: [0x60b9f5400] P/YA new playback state: Playing (playerRate: 1.000), NEED TO update item rate (1.000). Previous state: Paused, change reason: ClientInitiated default 19:34:54.509334+0800 mediaserverd <<<< FigFilePlayer >>>> playerfig_setBossRateWithFade: [0x60b9f5400] P/YA called, rate = 1.000, fadeDuration = nan, 176931.91441 default 19:34:54.509361+0800 mediaserverd <<<< FigFilePlayer >>>> playerfig_applySoftwareVolume: [0x60b9f5400] P/YA rp: [FigRenderPipeline 0x60ab95200], propertyName = SoftwareVolume1, targetVolume = 0.00, rampDuration = 0.00, synchronous = YES default 19:34:54.509413+0800 SpringBoard Elements ordered by promotion: ( ) default 19:34:54.509439+0800 ZebraPedia <<<< AVPlayer >>>> avplayer_fpNotificationCallback_block_invoke_13: P/YA setting timeControlStatus=2, reasonForWaitingToPlay=(null) default 19:34:54.509557+0800 mediaserverd <<<< FigFilePlayer >>>> playerfig_applySoftwareVolume: [0x60b9f5400] P/YA rp: [FigRenderPipeline 0x60ab95200], propertyName = SoftwareVolume5, targetVolume = 1.00, rampDuration = 0.00, synchronous = YES default 19:34:54.509634+0800 mediaserverd IOMobileFramebufferCreateDisplayList: All Display Instances enumerated successfully - FB Count = 1 default 19:34:54.510164+0800 mediaserverd <<<< Alt >>>> FPSupport_GetDisplayRefreshInformation: refreshRates:<private> default 19:34:54.510189+0800 SpringBoard quietMode is unchanged, still disabled default 19:34:54.510219+0800 mediaserverd <<<< Alt >>>> FPSupport_GetDisplayRefreshInformation: displayMaxRefreshInterval:1/10 displayMinRefreshInterval:1/120 displayRefreshStep:1/240 default 19:34:54.510251+0800 mediaserverd <<<< Boss >>>> FigPlaybackBossSetRateAndAnchorTime: (0x60ab9f2f0) called, newRate = 1.000, itemTime = nan, hostClockTime = (now+) nan default 19:34:54.510284+0800 mediaserverd <<<< Boss >>>> bossScheduleReachedEndCallbackForTime: (0x60ab9f2f0) called, endTime = nan default 19:34:54.510318+0800 mediaserverd <<<< Boss >>>> bossScheduleAdvanceForOverlappedPlaybackCallbackForTime: (0x60ab9f2f0) called, advanceTime = nan default 19:34:54.510351+0800 mediaserverd <<<< Boss >>>> bossConfigureRatePlan: requested rate 1.000 => will use audio time compression rate 1.000, timebase rate 1.000, NON-snippetised playback default 19:34:54.510382+0800 mediaserverd <<<< Boss >>>> figPlaybackBossSetRateToNonZero: (0x60ab9f2f0) last preroll is not compatible: no previous preroll default 19:34:54.510413+0800 mediaserverd <<<< Boss >>>> figPlaybackBossStartPrerollAndSetPlayState: (0x60ab9f2f0) called, prerollRate == 1.000, itemTime = nan, hostClockTime = nan, prerollTime = nan, useSnippetPlayback = NO, currentTimebaseTime == 0.000, newPlayState = PrerollingWillPlay default 19:34:54.510446+0800 mediaserverd <<<< Boss >>>> bossSetMentorModesToForwardPlayback: (0x60ab9f2f0) called, tracks 0...1, start time 0.000, end time nan, rate 1.00, previousOutputDisposition=3 default 19:34:54.510473+0800 mediaserverd <<<< Boss >>>> figPlaybackBossSetRateToNonZero: (0x60ab9f2f0) playState set to PrerollingWillPlay default 19:34:54.510505+0800 mediaserverd <<<< FAQ >>>> faq_reset: [0x606addc40:0x606a3c4d0] calling FigAudioQueueTimingShimReset default 19:34:54.510529+0800 mediaserverd <<<< FAQ TIMING SHIM >>>> FigAudioQueueTimingShimReset: [0x606c3f650] Calling AudioQueueReset(0x132dccd) default 19:34:54.510991+0800 mediaserverd AQMEIO_HAL.cpp:1185 User-selected BT device category is 0
Replies
1
Boosts
0
Views
1.1k
Activity
Apr ’23
NowPlaying State Not Updating on Apple Watch
My app plays music via AVAudioEngine. I'm using effects that prohibit me from using a built-in audio player. I'm using MPNowPlayingInfoCenter to provide information to the NowPlaying app on the Apple Watch. When I play a song, the Apple Watch displays the song metadata. When I hit pause on my phone, the Apple Watch shows that the track is no longer advancing via the progress wheel; however, it continues to display the pause button even though the music is paused. Ideally, it would switch to the play symbol when the music is paused. In the documentation it says you can use the playBackState var to set the playback state in macOS. There does not seem to be an equivalent in iOS. I figured maybe the watch would know to switch the pause symbol to the play symbol when the playback rate is 0, but it does not. All other functionality is working properly. The only thing that doesn't update on the watch is the pause / play symbol when the music toggles between play and pause by tapping my phone or from receiving remote command events. Thank you in advance for your help.
Replies
0
Boosts
0
Views
965
Activity
Apr ’23
Command Center media buttons is not syncing with App's media state Swift
I have created a media player plugin and exported it via swift framework for my Unity project, the media player works fine on the app. But, when the App's media state is paused the Command Center media button does not update its still on the pause icon and same as with playing the command center button does not update. I already have initiated the AVAudioSession shared instance and set the category to .playback and have also set the .setActive to true. let audioSession = AVAudioSession .sharedInstance() try audioSession .setCategory( .playback, mode: .default ) print("Playback OK") try audioSession.setActive(true) print("Session is Active") I also have initialised the command center, for handling the play and pause events whenever the buttons are clicked in command center. self.commandCenter.playCommand.isEnabled = true self.commandCenter.playCommand.addTarget { [weak self] (event) -> MPRemoteCommandHandlerStatus in self?.play() return .success } self.commandCenter.pauseCommand.isEnabled = true self.commandCenter.pauseCommand.addTarget { [weak self] (event) -> MPRemoteCommandHandlerStatus in self?.pause() return .success } This is the code for the handling the pause self.nowPlayingInfo[MPNowPlayingInfoPropertyElapsedPlaybackTime] = CMTimeGetSeconds(self.player.currentTime()) self.nowPlayingInfo[MPMediaItemPropertyPlaybackDuration] = CMTimeGetSeconds(self.player.currentItem!.duration); self.nowPlayingInfo[MPNowPlayingInfoPropertyPlaybackRate] = 0 self.nowPlayingInfo[MPNowPlayingInfoPropertyDefaultPlaybackRate] = 0 MPNowPlayingInfoCenter.default().nowPlayingInfo = self.nowPlayingInfo self.player.pause() and This is the code for handling the play self.nowPlayingInfo[MPNowPlayingInfoPropertyElapsedPlaybackTime] = CMTimeGetSeconds(self.player.currentTime()) self.nowPlayingInfo[MPMediaItemPropertyPlaybackDuration] = CMTimeGetSeconds(self.player.currentItem!.duration); self.nowPlayingInfo[MPNowPlayingInfoPropertyPlaybackRate] = 1 self.nowPlayingInfo[MPNowPlayingInfoPropertyDefaultPlaybackRate] = 1 MPNowPlayingInfoCenter.default().nowPlayingInfo = self.nowPlayingInfo; self.player.play() What i am expecting is when i click on pause in the App the command center's button should be the play icon if I click on play the command center's button should be pause icon, but right now nothing is working. Please tell me what I am missing here?
Replies
1
Boosts
0
Views
1.1k
Activity
Apr ’23