apache / apache/cordova-plugin-media

ANDROID: Audio is playing after releasing

Open
#299 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
391
Forks
762
PR merge metrics
No merged PRs in 30d

Description

# Bug Report

I'm not sure which side exactly the behavior described below is on. I'd like to figure it out.
So, when i release the media in some cases the audio is playing again.

### What is expected to happen?

The OS should "forget" about the media after the releasing.

### What does actually happen?
I have a player that uses the library.

So, I play the first song, then click the button to run the second one. After the click the first song media is releasing( media.release() ) and the second one starts playing. It looks ok in most cases, but when i switch to some other media between that temporary takes the audio focus, then after the media control turns back to my application the first song (released) is playing again and is overlapping the current one. Both songs are playing together. The OS get back the first song (released), but not the second one, that is already the current one actually.

To reproduce this, you can be changing different songs (releasing last ones) and:

- Call to yourself from some other phone. Stop the call and the focus will go back to you app causing the issue

- Open some video/audio file that takes the focus. After turning it back to you app you get the issue as well.

So, OS doesn't forget released songs.

### Environment, Platform, Device
I test it in xiaomi mi9t, android 10 miui 12

Contributor guide

Open the contributing guide

Research direction

No source file or test is named. Reproduce the issue on Android 10 with media.release(), audio-focus interruptions such as a call or another media file, and switching between songs; done means a released song does not resume or overlap the current song when audio focus returns.

Written by the indexing model from the issue text.

Assessment

Tech stack
android
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.