CommunityToolkit / CommunityToolkit/Maui

[BUG] Android implementation of MediaElement raises unexpected Stopped state change when playing using AutoPlay

Open
#3,079 5 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C#
Stars
2.7k
Forks
500
Avg merge
2d 14h
Merged PRs (30d)
7

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Did you read the "Reporting a bug" section on Contributing file?

- [x] I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug

### Current Behavior

The Android implementation of the MediaElement raises an unexpected Stopped state change when playback starts. This is the state change you would expect raised when playback stops. The Windows, Mac and iOS implementations work correctly.

Here the flow of state changes right now for the Android implementation:
Opening
**Stopped**
Paused
Buffering
Playing

### Expected Behavior

This is the flow that is expected:
Opening
Paused
Buffering
Playing

### Steps To Reproduce

1. Open and run the project from the reproduction repository
2. Make sure you are target at an Android device/emulator
3. Click the button and observe the state changes in the bottom label

### Link to public reproduction project repository

https://bitbucket.org/KeithBoynton/android-mediaelement-playstate-issue

### Environment

```markdown
- .NET MAUI MediaElement: 8.0.0
- OS: Any Android
- .NET MAUI: 10.0.31
```

### Anything else?

This issue is actually resolved in this PR: https://github.com/CommunityToolkit/Maui/pull/2897 however that PR has yet to be merged and is still in a draft state.

Contributor guide

Open the contributing guide

Research direction

Start with draft pull request #2897 and the Android MediaElement playback state transitions. Run the linked reproduction project on an Android device or emulator and observe the state label. Done means playback follows Opening, Paused, Buffering, Playing without an unexpected Stopped state.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, csharp
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.