Baseflow / Baseflow/XamarinMediaManager

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

Open
#816 7 comments 1 reaction 0 assignees View on GitHub
Dominant language
C#
Stars
763
Forks
299
PR merge metrics
No merged PRs in 30d

Description

## 🐛 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:**
- [x] :iphone: iOS
- [ ] :robot: Android
- [ ] :checkered_flag: WPF
- [ ] :earth_americas: UWP
- [ ] :apple: MacOS
- [ ] :tv: tvOS
- [ ] :monkey: Xamarin.Forms

Contributor guide

Open the contributing guide

Research direction

Start at the iOS app delegate initialization and trace CrossMediaManager.Current.Init() through the AVAudioSession setup. Reproduce the issue with Spotify playing before launch, then inspect when the audio session becomes active. Done means launching the app leaves existing music playing until the app starts media playback.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, ios
Domain
audio-video-rtc, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.