question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Music players stops when I start my app Xamarin.ios with media manager

See original GitHub issue

🐛 Bug Report

When I add media manager to my project, and initialize it, then deploy the app on my device. If I play music on a music player like Spotify before launching my app, the player stops playing music. I tried changing the AVAudioSession Category inside the app delegate, before initializing Xamarin media manager as follows; but it didn’t work.

AVAudioSession.SharedInstance().SetActive(false); AVAudioSession.SharedInstance().SetCategory(AVAudioSession.CategoryAmbient); AVAudioSession.SharedInstance().SetActive(true); CrossMediaManager.Current.Init();

Expected behavior

When launching a the app, it should stop the media player only when we start playing media in our app, and not at app start.

Reproduction steps

  • install Xamarin Media Manager in your xamarin ios project
  • Initialize in app delegate
  • Deploy to an iOS device
  • Start a music player and launch music on it (Spotify etc)
  • Start our app we deployed earlier
  • As soon as the app launches, the media player’s music stops

Configuration

Version: 1.x

Platform:

  • 📱 iOS
  • 🤖 Android
  • 🏁 WPF
  • 🌎 UWP
  • 🍎 MacOS
  • 📺 tvOS
  • 🐒 Xamarin.Forms

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

1reaction
stavroaudishocommented, Jan 3, 2023

Any news? @martijn00

0reactions
narciszaitcommented, Aug 23, 2022

maybe an idea would be to choose if we want to hijack the AudioSession when we call CrossMediaManager.Current.Init(); that causes the issue on iOS - line 106 here: https://github.com/Baseflow/XamarinMediaManager/blob/7056b8ce1f336b27ad20b9a98760e57697bd547d/MediaManager/Platforms/Ios/Player/IosMediaPlayer.cs#L106

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to keep audio playing when screen dims and locks?
I have a radio player embedded in my Xamarin.iOS app, but when the screen locks the audio stops playing. Per this thread https://forums.xamarin....
Read more >
Playing Audio with the MediaManager Plugin for Xamarin ...
Let me show you how to play Audio in Xamarin.Forms across Android, iOS and Windows UWP using the super easy plug and play...
Read more >
Play Audio in Xamarin Forms | Complete Music Player App
Xamarin Forms Masterclass (DISCOUNTED): https://bit.ly/3mOGwwV ... use of the Media Manager Plugin to make a music player app in Xamarin ...
Read more >
Android MediaPlayer service dies in about 20 minutes with ...
I'm working on a streaming player for Android and iOS with Xamarin.Forms, on iOS we have no problems with the background process. But...
Read more >
Xamarin Community Toolkit MediaElement
This article explains how to use MediaElement to play video and audio in a Xamarin.Forms application.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found