Post

Replies

Boosts

Views

Activity

How to resume audio playing of other apps after dismissing AVPlayerViewController?
I use AVPlayerViewController to play short videos in my app.If there is an app playing audio in background before user plays a video in my app, I want the background audio playing of the other app to resume after my video player is dismissed. I currently use AVAudioSession.setActive(false, with: .notifyOthersOnDeactivation) to do that.Even though Apple's Music app and Podcasts app do resume playing after I call AVAudioSession.setActive(false, with: .notifyOthersOnDeactivation)—won't resume without the call so it means this call does have effect—none of the 3rd party music or podcast apps that I tested(Spotify, SoundCloud, Amazon Music, Overcast) do.I doubt it's because none of these popular 3rd party apps supports background audio resuming. There must be something missing in my code:class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) // I know it's not the best place to call setActive nor it covers all the cases. It's just a convenient place to put the code to test its effect after dismissing the video player. do { try AVAudioSession.sharedInstance().setActive(false, with: .notifyOthersOnDeactivation) try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryAmbient) try AVAudioSession.sharedInstance().setActive(true) } catch { print(error) } } @IBAction func play(_ sender: Any) { do { try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback) try AVAudioSession.sharedInstance().setActive(true) } catch { print(error) } let playerController = AVPlayerViewController() playerController.player = AVPlayer(url: URL(string: "http://gslb.miaopai.com/stream/UkjiD45ddxZFQ79I2bLaGg__.mp4")!) playerController.player?.play() present(playerController, animated: true) } }Even though someone on Stack Overflow thinks this code is fine and its these 3rd party apps' fault, I still believe there are something that can be done to make them resume audio playback because Twitter app can. But I don't know what Twitter does to achieve that, anyone knows?PS: here is the complete project so anyone interested can try it.
1
0
2.3k
Feb ’17
Initial Purchase Date of app(not IAP)
(I cannot find any better place to post this question so I post it here even thought it is not directly about IAP.)This is from WWDC 2013 Session 308 — Using Receipts to Protect Your Digital Sales:You've got purchase information about the app itself, plus the In-App Purchases that the user has made, and there's also information there, I mentioned as well, about the Volume Purchase Program, but I think the most exciting thing that we've added to the receipt this year is the initial purchase date and initial purchase version.So for everyone that's got a paid app on the store today, and you want to make the transition to being a free app with In-App Purchases, previously that used to be quite a challenge for you, because if you simply switch to being a free app with In-App Purchases, your customers would have to go and buy all those In-App Purchases again, but they've already paid for it, and they're not going to like that.So now in the receipt itself we have the date, when the user first purchased your app, and the version that it was at that time.So you can use this to make a really informed, intelligent decision about what features and content to grant this user into, so if your app looks at the receipt and inspects it and sees this user bought my app before I made the switch to being free with In-App Purchases, grant them into what they've paid for, but if they purchased your app after you've made the transition to being free with In-App Purchases, you know then not too unlock features and content until they make the purchase and you verify that transaction with the receipt itself.However, I don't see the Initial Purchase Date field in the receipt. Neither I see it mentioned in Receipt Validation Programming Guide. Is Initial Purchase Date of app really avaiable in the receipt? If so how can I extract it?
2
0
1.7k
Jul ’16
How to change subscription group info?
I changed App Name Display Option from Use App Name to Use Custom Name about 10 days ago, then I released a new version of the app today. However, the infomation in the App Store is not updated, and the updated info on App Store Connect are still displayed in yellow color with this text:"We'll review the new name before we make it available on the App Store."Do I need to submit the change to review manually? How?
2
0
3.0k
Jan ’20