android-components / mozilla.components.feature.media / MediaFeature

MediaFeature

class MediaFeature (source)

Feature implementation for media playback in web content. This feature takes care of:

  • Background playback without the app getting killed.
  • Showing a media notification with play/pause controls.
  • Audio Focus handling (pausing/resuming in agreement with other media apps).
  • Support for hardware controls to toggle play/pause (e.g. buttons on a headset)

This feature should get initialized globally once on app start and requires a started MediaStateMachine.

Constructors

Name Summary
<init> MediaFeature(context: <ERROR CLASS>)
Feature implementation for media playback in web content. This feature takes care of:

Functions

Name Summary
enable fun enable(): Unit
Enables the feature.

Companion Object Properties

Name Summary
ACTION_SWITCH_TAB const val ACTION_SWITCH_TAB: String
EXTRA_TAB_ID const val EXTRA_TAB_ID: String
NOTIFICATION_TAG const val NOTIFICATION_TAG: String
PENDING_INTENT_TAG const val PENDING_INTENT_TAG: String

Extension Functions

Name Summary
loadResourceAsString fun Any.loadResourceAsString(path: String): String
Loads a file from the resources folder and returns its content as a string object.