Media Player

RSS for tag

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

Media Player Documentation

Posts under Media Player tag

84 Posts
Sort by:
Post not yet marked as solved
0 Replies
570 Views
I have an AVPlayerViewController in my app to play custom audio+image or video streamed from an online service. If I set the below, I am able to add info to the nowPlayingInfo dictionary avplayerController.updatesNowPlayingInfoCenter = false This works for iOS control centre, it correctly displays my custom album name, artwork etc. But when using airplay for audio, it only displays the track name while playing audio. It doesn't display the artwork or the album etc. However if I set avplayerController.player?.allowsExternalPlayback = false It does correctly display artwork, title, album etc. This however disables the airplay button thats inbuilt on the player. I would like this button to remain, but need the artwork to be displayed while airplay-ing. How to I achieve this?
Posted
by
Post not yet marked as solved
1 Replies
588 Views
Hello, I have a music player application that uses MPMusicPlayerController to play Apple Music songs. Now I want to add a Widget to it that can trigger playback pause on iOS 17. How do I need to achieve this? I can get the playbackStoreID of the song on the Widget Extension and use MPMusicPlayerController setQueue(with:) to play it. How do I pass the playbackStoreID in the Widget to the main application for playback, or should I create a new MPMusicPlayerController on the Widget Extension for playback?
Posted
by
Post not yet marked as solved
1 Replies
348 Views
We have received a lot of user feedback, saying that our app caused the video in the user's system album to not play, we did reproduce this phenomenon after operating some modules of our app many times, after monitoring the device log, click on the system album z probably received the following abnormal error VideoContentProvider received result:<AVPlayerItem: 0x281004850, asset = <AVURLAsset: 0x28128fce0, URL = file:///var/mobile/Media/DCIM/100APPLE/IMG_0085.MP4>>, info:{ PHImageResultRequestIDKey = 316; }, priority:oneup automatic, strategy:<PXDisplayAssetVideoContentDeliveryStrategy: 0x2836c3000>quality: medium+(med-high), segment:{ nan - nans }, streaming:YES, network:YES, audio:YES, targetSize:{1280, 1280}, displayAsset:8E30C461-B089-4142-82D9-3A8CFF3B5DE9 <PUBrowsingVideoPlayer: 0xc46a59770> Asset : <PHAsset: 0xc48f5fc50> 8E30C461-B089-4142-82D9-3A8CFF3B5DE9/L0/001 mediaType=2/524288, sourceType=1, (828x1792), creationDate=2023-07-19 上午7:36:41 +0000, location=0, hidden=0, favorite=0, adjusted=0 VideoSession : <PXVideoSession 0xc48a1ec50> { Content Provider: <PXPhotoKitVideoContentProvider: 0x282d441e0>, Asset <PHAsset: 0xc48f5fc50> 8E30C461-B089-4142-82D9-3A8CFF3B5DE9/L0/001 mediaType=2/524288, sourceType=1, (828x1792), creationDate=2023-07-19 上午7:36:41 +0000, location=0, hidden=0, favorite=0, adjusted=0 , Media Provider: <PUPhotoKitMediaProvider: 0x28104da70> Desired Play State: Paused Play State: Paused Stalled: 0 At Beginning: 1 End: 0 Playback: ‖ Paus √ b0 a0 s0 l1 f0 e0 r0.0 0.000/60.128 VideoOutput: (null) Got First Pixel Buffer: NO Pixel Buffer Frame Drops: 0 Buffering: 0 }: Starting disabling of video loading for reason: OutOfFocus <PUBrowsingVideoPlayer: 0xc46de66e0> Asset : <PHAsset: 0xc48f5f1d0> 11ECA95E-0B79-4C7C-97C6-5958EE139BAB/L0/001 mediaType=2/0, sourceType=1, (1080x1920), creationDate=2023-09-21 上午7:54:46 +0000, location=1, hidden=0, favorite=0, adjusted=0 VideoSession : (null): Starting disabling of video loading for reason: OutOfFocus I think this message is imporant VideoSession : (null): Starting disabling of video loading for reason: OutOfFocus restart the iPhone can resolve this anomalous ,can you know reason or how to avoid this bug the bug like :https://discussionschinese.apple.com/thread/254766045 https://discussionschinese.apple.com/thread/254787836
Posted
by
Post not yet marked as solved
0 Replies
301 Views
Typically when uploading ePubs into Books all that was required was to drag them either into the app directly or onto the Books icon. In MacOS Sonoma Books accepts ePubs but rejects them about a minute or two later. Curious about this behavior I went to the folder where ePubs are stored, and moved the books directly to it instead of via the Books app. Once you move them into the folder, the same behavior that you see in the app happens with the folder (books appear in the folder, then vanish from the folder a minute or two later).
Posted
by
Post not yet marked as solved
0 Replies
437 Views
Hello! In our website, we allow members to follow private RSS feeds on their Podcasts app easily with the click of a button. Underneath the button is a link in the format of: podcast://example.rssurl.com # Example With this URL scheme, the Podcasts app launches correctly and shows the "Follow a Show by URL" input box, with the private RSS feed URL prefilled. However, the prefilled URL uses HTTP instead of HTTPS. So, the example link above (podcast://example.rssurl.com) when clicked is converted to: http://example.rssurl.com in the "Follow a Show by URL" input box in the Podcasts app. We noticed the HTTP form of the URL does not work well, as it sometimes fail to follow the show. Clicking on "Follow" would simply close the box and cause nothing to happen, not even error messages. We then tested with HTTPS by manually inserting the URL like so: https://example.rssurl.com and this would always work. However, this is not ideal as our users would have to manually paste in the URL all the time. It'd be great if the Podcasts URL scheme above would automatically prefill the "Follow a Show by URL" input box with the HTTPS form instead. Is there a way to force this behavior or is this intended from Apple's side? Thank you!
Posted
by
Post not yet marked as solved
1 Replies
471 Views
Hello Everyone, I'm working on creating an audio playback widget for my app, aiming for functionality similar to the Apple Music widget. Specifically, I've implemented a play button in my widget that triggers an AudioPlaybackIntent. This intent then interacts with a singleton class that manages my AVAudioPlayer. The issue I'm facing is that the AVAudioPlayer instance in my main app and the instance in my widget extension don't seem to share the same state. I've noticed that the Apple Music widget is capable of showing real-time changes (eg. stopping music from command center, stops it on widget UI), which implies that it has some way of sharing the playback state between the main app and the widget. How can I achieve shared state between the main app and widget for my AVAudioPlayer instance? Is there a specific approach or API that Apple Music uses to make this happen?
Posted
by
Post not yet marked as solved
0 Replies
640 Views
In our application, we play video-on-demand (VOD) content and display subtitles in different languages. The format we prefer for subtitles is WebVTT. We are planning to enhance caption styling (text color, background color, font weight, etc.) in WebVTT files. In our current flow, subtitles and images are loaded in 6-second chunks. Below is an example of one of the subtitle parts we use: WEBVTT X-TIMESTAMP-MAP=MPEGTS:0,LOCAL:00:00:00.000
Posted
by
Post not yet marked as solved
1 Replies
593 Views
I've integrated MPVolumeView into my view, and it correctly responds to hardware volume changes as expected. However, once I initiate audio streaming using AVAudioEngine to capture microphone audio and AudioUnit for decoding, the MPVolumeView ceases to reflect changes made using the hardware volume buttons. Additionally, even when I adjust the volume using the slider on MPVolumeView, it doesn't change the system volume. Has anyone else encountered this issue? What might be causing MPVolumeView to stop responding to hardware volume changes once streaming starts? For the AVAudioSession.Mode, I use the default setting because using .voiceChat prevents MPVolumeView update from device volume changes permanently. let session = AVAudioSession.sharedInstance() do { try session.setCategory(.playAndRecord, options: [.allowBluetooth]) try session.setActive(true) } catch { print(error.localizedDescription) }
Posted
by
Post not yet marked as solved
0 Replies
335 Views
Hi. I am transitioning my app from using MPMediaQuery to using MusicLibraryRequest from MusicKit. This is working fine for playlists in the user's library. I also allow my app users to play their podcasts. I currently use MPMediaQuery.podcasts(). Does anyone know if there is an equivalent using MusicLibraryRequest? Cheers, Ian
Post not yet marked as solved
6 Replies
1.6k Views
Am I the only one having this problem? The Music app on iOS 17 beta does not cleanly seque between songs that are intended to have no gap between them. When gapless songs are played (e.g., Pink Floyd's "Dark Side of the Moon", The Beatles' "Abbey Road"), a noticeable gap is heard between songs. These are songs in my music library that I sync from my computer, not Apple Music streams. It should be noted that this bug also exists in iOS 16.6, and I've verified that the problem does not occur on a older phone running iOS 15.7.8. More importantly, when I put the device in Airplane mode, the songs seque correctly, without any gaps. I suspect that the Music app is phoning home to Apple (a bad practice in and of itself) and something is interrupting playback queuing. Even when I have Cellular access turned off for the Music app, and am not connected to Wi-Fi, the problem persists. The only way to make gapless playback work is to turn off all of the device radios via Airplane mode. Understand that this is NOT a cross-fade issue. It is a gapless issue. And it's not an Apple Music streaming issue. The problem seems to be more prevalent for songs encoded as 128 kbps AAC. In comparison, the Music app on macOS (Ventura, 13.5) operates correctly. It's only iOS that no longer performs gapless playback. I've filed bug reports (FB12992049 and FB13019931), but have not heard anything from Apple. Like I asked at the beginning, am I the only one having this problem? It's extremely maddening that Apple can't get this right. I can't play my Pink Floyd, Alan Parsons, and my other AOR playlists, including my late 60's Beatles. Steve Jobs would be rolling in his grave.
Posted
by
Post not yet marked as solved
1 Replies
446 Views
There’s an unexpected behaviour when using the append(_:) & prepend(_:) methods on iOS 17 Beta 6 and Public Beta 4. Observed Behaviour When queuing using the mentioned methods on recent iOS 17 Betas, the supplied music isn‘t queued up and the now playing music pauses. When using applicationQueuePlayer, it even ends up crashing the app. FB13010449 Sample Project
Posted
by
Post not yet marked as solved
1 Replies
716 Views
Problem Description This HLS video https://lf3-vod-cdn-tos.douyinstatic.com/obj/vodsass/hls/main.m3u8 starts with noise at 22 seconds play directly on MacOS 12.6.6 Safari,and it also appears on iOS (16.5.1) safari. But there is no noise when playing with MSE on Mac by the third-party open source web playe such as hls.js on Safari. Test tool hls.js test demo: https://hlsjs.video-dev.org/demo/
Posted
by
Post not yet marked as solved
1 Replies
666 Views
Hi. In iOS 17 Apple introduced crossfading for the Music app. In my app I am using MPMusicPlayerController.applicationQueuePlayer and also want to support crossfading. In an early beta of iOS 17 my app crossfaded automatically with the same setting as for the Music app which maybe was a bug. However, I did not find any way to enable crossfade for my app. Does anybody know how to do that? Thanks, Dirk
Posted
by
Post not yet marked as solved
0 Replies
776 Views
Hi I'm developing a full-duplex iPhone voice chat application and I'd like to intercept bluetooth headset button events to perform certain actions in my app while maintaining a full-duplex audio. I'm using the MediaPlay to intercept remote bluetooth AVRCP MPRemoteCommandEvent play/pause events as well setting AVAudioSession to use the BluetoothA2DP category, however, when I do this, I can't seem to use the bluetooth microphone as an audio input. Specifically, when I query AVAudioSession for available inputs, bluetooth is not returned. I'm guessing this is because A2DP is a half-duplex protocol, but my understanding is that AVRCP events are only available with A2DP. The other bluetooth profile choice is HSP (AVAudioSession category Bluetooth), which works for full-duplex audio, but does not appear to provide a way to intercept the various AT commands from this profile unless I'm in an actual telephone call. For example, when I use HSP and press a button on my headset, I see in the logs the AT+CHUP command being sent from the headset to the phone. Two questions: Is there a way to use a bluetooth microphone while using A2DP for output at the same time? If the above can't be done, is there a way to intercept the HSP AT control commands from a headset without being in a telephone call? Thanks.
Posted
by
Post not yet marked as solved
0 Replies
563 Views
I have noticed changes Apple Music made to my library, take in particular a changed album edition that is reflected in how the title is listed. I can see the new title in the Music app in two different devices. On one device MPMediaQuery returns the album with the new title. The other device (an iPad with less memory, in case that matters) is still returning the old edition. Is there anything I can do to make sure the data returned is up to date and matches what is seen in the Music app?
Posted
by
Post not yet marked as solved
1 Replies
1.1k Views
I imported the MediaPlayer framework and used MPMusicPlayerPlayParameters in my SwiftUI project. While the app is launching, If the app is built by Xcode 14.3.1 or a newer version, it instantly crashes on a simulator or on a real device. This problem persists on iOS 16.0 to 16.4. (I haven't tried iOS 15 or below) I also tried to build and run the app with Xcode 15 - beta 4 however it still crashes. Because of this reason, I archive and submit to App Store with Xcode 14.2. (the built made by Xcode 14.2 works perfectly!!) Here is the error message: dyld[17235]: Symbol not found: _$sSo27MPMusicPlayerPlayParametersCSe05MediaB0Mc Referenced from: <77FEF170-9C51-3580-8F8B-2ADD2F1B3FD1> /Users/[UserName]/Library/Developer/CoreSimulator/Devices/72CE26D8-4DD4-4319-B0C7-DE52D6645875/data/Containers/Bundle/Application/C808623F-5372-40F0-907F-E86E12AE6EDD/[AppName].app/[AppName] Expected in: <06F636E1-695C-34F1-809D-7CA24F67AFE9> /Library/Developer/CoreSimulator/Volumes/iOS_20B72/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 16.1.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/MediaPlayer.framework/MediaPlayer I believe this is Apple related issue however if there is any way that can fix the issue, please let me know.
Posted
by
Post not yet marked as solved
0 Replies
742 Views
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?
Posted
by
Post not yet marked as solved
0 Replies
448 Views
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.
Posted
by