Skip to content

[Proposal] Add MediaElement Foreground Service to Media Options #2657

@ne0rrmatrix

Description

@ne0rrmatrix

Feature name

Media Element Foreground Service Options

Link to discussion

#2225

Progress tracker

  • Android Implementation
  • iOS Implementation
  • MacCatalyst Implementation
  • Windows Implementation
  • Tizen Implementation
  • Unit Tests
  • Samples
  • Documentation

Summary

Add support to disable Media Element Android service as a Builder option in MediaElement Options class

Motivation

Allow developers to choose whether they want to have a foreground service and if they want to have notifications. Not all use case scenarios need the service or notifications.

Detailed Design

API:

MediaElementOptions

/// <summary>
/// Set Android Foreground Service for MediaElement on construction
/// </summary>
internal static bool AndroidForeServiceEnabled { get; private set; } = true;

Usage Syntax

Here is an example of `AndroidForegroundServiceEnabled`

XAML:

 <toolkit:MediaElement
     x:Name="MediaElement"
     ShouldAutoPlay="True"
     AndroidForegroundServiceEnabled="True"
     Source="{x:Static constants:StreamingVideoUrls.BuckBunny}"
     />

Drawbacks

None. If users choose to ignore setting option it will default to current behavior. The current behavior is service is enabled by default.

Alternatives

If we do not add this it will continue to always be on and leave less choice for developers. I have seen many use cases where the current always on service may not be optimal.

Unresolved Questions

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    newproposalA fully fleshed out proposal describing a new feature in syntactic and semantic detail📽️ MediaElementIssue/PR that has to do with MediaElement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions